簡體   English   中英

訪問令牌 LinkedIn API

[英]access token LinkedIn API

對於學校項目,我需要訪問 LinkedIn API。 我已經在 LinkedIn Developers 上創建了一個應用程序。 但是,當我向https://www.linkedin.com/oauth/v2/authorization發出 GET 請求時,我無法獲得訪問令牌,並且我得到“您需要通過范圍”即使文檔指定 scope 字段是可選的,我在請求末尾添加了 scope=scope=r_liteprofile%20r_emailaddress%20w_member_social 並得到“無效的 scope 錯誤”。 至於redirect uri字段,我不知道該放什么(我可以放一個隨機網站URL嗎?)

如果有人知道該問題的解決方案或知道其他獲取訪問令牌的方法,我將非常感激:) 謝謝!

您需要提供重定向 URI 才能獲得有效的訪問令牌。

第一步:

https://www.linkedin.com/oauth/v2/authorization?response_type=code&client_id=YOURCLIENTID&redirect_uri=https://my.webserver.com

登錄並確認后,LinkedIn 將使用 code 參數將您重定向到提供的重定向 URI。 下一步是將此代碼交換為訪問令牌。

第二步:

https://www.linkedin.com/oauth/v2/accessToken?grant_type=authorization_code&code=CODE&redirect_uri=https://my.webserver.com&client_id=YOURCLIENTID&client_secret=YOURCLIENTSECRET

如果一切正常,LinkedIn 將再次重定向到提供的重定向 URI,但這次使用訪問令牌。

希望能幫助到你。

這是一篇很好的文章,應該可以幫助您https://medium.com/@ellesmuse/how-to-get-a-linkedin-access-token-a53f9b62f0ce

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM