Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Fzamk19
Contributor
Contributor

How can I make a rest api call using Oauth1 authentication?

I am new to Talend as well as Java. Really stuck on how can I use oauth1 authentication in talend? Can't see any option in trest and no syitable solution online. Please help me!

Labels (2)
14 Replies
Anonymous
Not applicable

Hi Team,

 

We have OAuth 1.0 client utilities in CXF so one option is to use either tREST or tRESTClient with tJava sitting in from of tREST and preparing an OAuth 1.0 signature . tREST would simply pass along HTTP Authorization headers with all OAuth 1.0 parameters listed. 

Here is a related topic:https://community.talend.com/t5/Design-and-Development/resolved-OAuth-1-0a-with-tRESTClient-tRESTRes...

Best,

Yussef

Fzamk19
Contributor
Contributor
Author

Yeah I already saw that post but What is cxf and how to use it? Im using DI TOS

Anonymous
Not applicable

Do you have the API specifications? These should talk you through how to make use of this. OAuth 2 is a little more common than OAuth 1. I have used dozens of APIs which use OAuth 2 and they always have a section talking the user through how to implement this.

Fzamk19
Contributor
Contributor
Author

Yeah I have the details from them and I also made the request successfully using the postman. They use oauth1 and they have shared that the header should be like this

OAuth

oauth_signature="JA0PvBbTAxmtLmzIWINpSVLshrY%3D",

oauth_version="1.0",

oauth_nonce="c1c04ec4-3125-44cf-9c39-cccb9343541b",

oauth_consumer_key="d392e7ff2e204d6c802e38fd775563d1",

oauth_signature_method="HMAC-SHA1",

oauth_token="61adad31204a4e6fab68d560f1ffb594",

oauth_timestamp="1261039670

*dummy data

Fzamk19
Contributor
Contributor
Author

They shared the access token&secret as well as consumer token&secret. But I can't get my head around these other values like timestamp, signature & nonce and how can I pass these into header value in trest comp

 

 

Anonymous
Not applicable

Have you tried looking at the Advanced tab of the tRESTClient? That has a header section. You can add your headers there and give it a try. However, I should point out that APIs can vary quite a lot from one to the next. So there are seldom universal ways of getting stuff like this working. A lot of trial and error is usually involved. But you should be able to see your progress from looking at the response you get.

Fzamk19
Contributor
Contributor
Author

Thank you rhall, Yeah I can see those headers options but the point is that how can I get those unknown values? I can see oauth2 option in trestclient but no oauth1.. 

Anonymous
Not applicable

The unknown values require a complicated processes in OAuth 2.0 as well. I am not familiar with OAuth 1.0, which is why I asked about the documentation. But for OAuth 2.0 you need to go through an authentication process to generate tokens which will generate further tokens for access. This is not handled automatically by Talend.....because there isn't a single way of doing this. The functionality is enabled to make use of the authentication systems, but getting the required values/tokens needs to be handled by you OR a process you build using a Talend job. As an example of this, you can take a look here for an example I wrote a while ago on generating OAuth 2.0 tokens....

 

https://community.talend.com/s/feed/0D53p00007vCx7qCAC#M587

 

As you'll see, it isn't an "out of the box" solution. Your API provider will provide with you the steps you need to take to get those values. We really cannot help you do that here without having the API documentation.

Fzamk19
Contributor
Contributor
Author

Thank you rhall for the detailed explanation. Really appreciate it. This liveperson api 'messaging interactions', documentation is available online but I can't see anything on how to get those or create those unknown values 😕