Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I want to get data from Xero API which uses OAuth2.0 authentication. Any idea how can I achieve this in TOS-DI v7.3?
Addition info:
As mentioned in the document, I need to first generate a code(refresh token) using which I will get my Bearer Token.
Xero link:
https://developer.xero.com/documentation/guides/oauth2/auth-flow/#3-exchange-the-code
Thanks in advance.
Hi, you can use TrestClient component with Oauth2.0 as authentification parameter.
Send me Love and Kudos
Umm yeah, but how to get the Bearer Token?
Okay, I think I need to edit my post to explain it in more detail.
Thanks anyways 🙂
everithing is explained in your doc :
you have to make a first call with a post method
https://identity.xero.com/connect/token
with some info in the body
and a specific header for the authorization
you have to write a String named string wich contain the grant type (authorization_code), code and redirect_uri
with this value:
"grant_type=authorization_code&code=xxxxxx&redirect_uri=https://myapp.com/redirect"
you could do this in a trowgenerator or a tfixedflowinput for example.
Then connect it to the trestclient with a main row.
In trestclient :
URL : "https://identity.xero.com/connect/token"
HTTP Method : POST , Content Type FORM , Accept Type Any
in advanced setting :
Http Headers
name : "authorization" value : "Basic " + Base64.encode((client_id + ":" + client_secret).getBytes())
okay, but that's step-3 but how to implement step-1 and 2?
It's seems you can do part 1 and 2 with an app not talend cause you have redirection and not json response.
yeah, I also kind of resonate with you on this. Although I am hoping to get an official response from Talend.
I tried doing it in thttprequest and trestclient but none of them worked.
In trestclient, there is an option to check the "Follow redirects" and "Allow non-same host redirects" which I did and I gave my Xero creds in "Basic HTTP" authentication but no luck. It's returning an HTML.
Is there any other Talend product that can handle this?
maybe you have the info in the html , you can extact them if you can see specific pattern inside.
nope. it was just a nonfunctional HTML doc with tags like username and password. My trestclient is just reading the content of the redirect URL and not passing the username password which I have provided in the component.