Connecting to API and doing requests

Asked by João Pereira

Hello,
I am building a Ruby gem to connect to launchpad, and i am following the instructions on the API, but i get to a step where i cannot go further. These are the steps that i was able to do:
1 - I request the token and my application open the login of launchpad,
2 - I enter my credentials there and select the access
3 - Login redirects again to my application and i convert my request token into an access token
4 - I get the access token back.
Now the problems start

This is my request for the access token
 Data: oauth_consumer_key=baboon&oauth_token=4QTnLTbq2nrfRr7gDmGX&oauth_signature_method=PLAINTEXT&oauth_timestamp=1428074226&oauth_nonce=KBS938Uv5m9J8ep1iMQ102zqXypCW4ZXADgJCRK4c&oauth_version=1.0&oauth_signature=%2639LHB60L5xqc7k3kwVHSLKD0cnFCjcC5GxDtGRpRpBWpGFhskFklD4j1SJdDPMFgZZvlWqD4n4L7fMz7

The answer is:
oauth_token=3DdcJk9tnftMp7Wtwhvd&oauth_token_secret=zz9ww6xLJ566TP8CSqC5gh9g5jvlDKFnnRC6TLvjCHPqpL5KRrbchPFPL19fRnMQxJZ0Np3q2cSdxtd8&lp.context=None

Which looks ok. After this i try to do a get request to people/+me with the following headers:
Sending: GET http://launchpad.net:443/people/+me
Header: accept: application/json
Header: accept-encoding: gzip;q=1.0,deflate;q=0.6,identity;q=0.3
Header: user-agent: OAuth gem v0.4.7
Header: authorization: OAuth realm="https://api.launchpad.net/", oauth_consumer_key="baboon", oauth_nonce="Us2AKZlaxM7wLGUhqslkiTf2XtiW3rej7XTtw6VcgWI", oauth_signature="%26zz9ww6xLJ566TP8CSqC5gh9g5jvlDKFnnRC6TLvjCHPqpL5KRrbchPFPL19fRnMQxJZ0Np3q2cSdxtd8", oauth_signature_method="PLAINTEXT", oauth_timestamp="1428074228", oauth_token="3DdcJk9tnftMp7Wtwhvd", oauth_version="1.0"

But i get redirected to
Header: location: https://launchpad.net/people/+me/+login
Like if my token was not able to login.....

Does anyone see any issue with these requests?

Thanks

Question information

Language:
English Edit question
Status:
Answered
For:
Launchpad itself Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
William Grant (wgrant) said :
#1

The main launchpad.net webapp only supports cookie authentication, not OAuth. You need to use https://api.launchpad.net/ if you want to authenticate using OAuth. Make sure you've read through https://help.launchpad.net/API/Hacking, and try your request against https://api.launchpad.net/devel/people/+me instead.

Also, you should probably revoke the token whose secret you've just disclosed to the world.

Can you help with this problem?

Provide an answer of your own, or ask João Pereira for more information if necessary.

To post a message you must log in.