
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Fetch data using Xero API (Oauth2.0) in TOS - DI v7.3
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, you can use TrestClient component with Oauth2.0 as authentification parameter.
Send me Love and Kudos

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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 🙂

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
you have to write a String named string wich contain the grant type (authorization_code), code and redirect_uri
- grant_type=authorization_code
- code=The authorization code you received in the callback
- redirect_uri=The same redirect URI that was used when requesting the code
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())

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
okay, but that's step-3 but how to implement step-1 and 2?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's seems you can do part 1 and 2 with an app not talend cause you have redirection and not json response.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
maybe you have the info in the html , you can extact them if you can see specific pattern inside.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
