5
votes

I am simply trying to login using LinkedIn. According to LinkedIn they are using OAuth 1.0a, which means I should send the oauth_callback param when getting the request token. Here is the link I am generating below.

https://api.linkedin.com/uas/oauth/requestToken?oauth_callback=http%3a%2f%2flocalhost%3a2161%2flogin%2flinkedin

I get a valid response back with the oauth_token, oauth_token_secret, oauth_callback_confirmed=true, etc.

However after I log into LinkedIn I get the OOP code to enter into my app instead of it just redirecting using the oauth_callback I sent it.

The url I am testing with right now is my localhost machine, but it does the exact same thing on the live server.

Any thoughts on this. I've searched LinkedIn and other stackoverflow answers, tried a lot of stuff, none of it has worked.

using C#, ASP.NET MVC 3, .NET 4.0

1
It's possible that they have a bug; you can write them about that problem. In their documentation it's written that they handle the oauth_callback parameter, so it should not be OOP.luben

1 Answers

3
votes

The oauth_callback should be sent in the header of the request for the request token and not the query string. For example:

POST https://api.linkedin.com/uas/oauth/requestToken HTTP/1.1
Authorization: OAuth oauth_callback="http%3a%2f%2flocalhost%3a2161%2flogin%2flinkedin", oauth_consumer_key="YOUR_KEY", oauth_nonce="SOME_NOUNCE", oauth_signature="YOUR_SIGNATURE", oauth_signature_method="HMAC-SHA1", oauth_timestamp="YOUR_TIMESTAMP", oauth_version="1.0"
Host: api.linkedin.com
Connection: Keep-Alive

More info is available here: http://developer.linkedin.com/docs/DOC-1245

You'll see that oauth_callback is optional, and because LinkedIn doesn't see your oauth_callback in the "Authorization" header, it's redirecting the user to the "OAuth Redirect URL" that you specified in your application setting. However, I'm guessing that you left this "OAuth Redirect URL" setting blank, and that's why you're being redirected to the OOP page.

I hope that helps.