2014-02-05 186 views
0

我希望我在適當的位置發佈此信息。Linkedin認證失敗

我試圖通過教程make your first LinkedIn API call using OAuth 2.0.

http://developer.linkedin.com/documents/authentication

一個工作。生成授權碼通過重定向用戶到LinkedIn的授權對話框

https://www.linkedin.com/uas/oauth2/authorization?response_type=code 
&client_id=YOUR_API_KEY 
&scope=SCOPE 
&state=STATE 
&redirect_uri=YOUR_REDIRECT_URI 

填寫了這一點:

https://www.linkedin.com/uas/oauth2/authorization?response_type=code 
&client_id=123456789 
&scope=r_basicprofile%r_network% 
&state=abcdefghi 
&redirect_uri=http://www.socialinnovationlab.net 

賦予的

https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=123456789&scope=r_basicprofile%r_network%&state=abcdefghi&redirect_uri=http://www.socialinnovationlab.net 

URI並由此給LinkedIn身份驗證形式,因爲它應該。

b。請求訪問令牌由它

https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code 
&code=AUTHORIZATION_CODE ****I think this is the above uri?****** 
&redirect_uri=YOUR_REDIRECT_URI 
&client_id=YOUR_API_KEY 
&client_secret=YOUR_SECRET_KEY 

交換authorization_code我:

https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code 
             &code=https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=123456789&scope=r_basicprofile%r_network%&state=abcdefghi&redirect_uri=http://www.socialinnovationlab.net 
&redirect_uri=http://www.socialinnovationlab.net 
&client_id=123456789 
&client_secret=1212121212 

其中givies的URI:當我嘗試去這個地址我得到的

https://www.linkedin.com/uas/oauth2/accessToken?grant_type=authorization_code&code=https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=123456789&scope=r_basicprofile%r_network%&state=abcdefghi&redirect_uri=http://www.socialinnovationlab.net&redirect_uri=http://www.socialinnovationlab.net&client_id=123456789&client_secret=1212121212 

錯誤:

{"error":"invalid_request","error_description":"missing required parameters, includes an invalid parameter value, parameter more then once. : client_id"} 

任何想法,我哪裏出錯了?

謝謝

+0

蒂姆你知道嗎?我和你有同樣的錯誤。我可以使用curl成功獲取訪問令牌,但不能使用Python。總是得到400。 – user1387717

回答

1

在步驟a。當您導航到

https://www.linkedin.com/uas/oauth2/authorization?response_type=code&client_id=123456789&scope=r_basicprofile%r_network%&state=abcdefghi&redirect_uri=http://www.socialinnovationlab.net 

您會看到LinkedIn授權表單。一旦你提交表單你會被重定向到

http://www.socialinnovationlab.net?code=AUTHORIZATION_CODE&state=abcdefghi 

參數code在上面的網址將包含您的授權碼。這是在步驟b中您需要在URL的code參數中使用的授權代碼。

+0

謝謝kate2753 – xyz