Linkedin oauth2 r_liteprofile 沒有從 api 返回 (Linkedin oauth2 r_liteprofile not being returned from api)


問題描述

Linkedin oauth2 r_liteprofile 沒有從 api 返回 (Linkedin oauth2 r_liteprofile not being returned from api)

所以我有一個 Rails 應用程序,我正在使用 這個用於 oauth2 的 gem。現在在linkedin的開發者控制台上,我只能選擇

r_basicprofiler_emailaddressrw_company_adminw_share</代碼>。

所以我選擇了 r_basicprofile

現在一旦確定linkedin在推送用戶到http://localhost:3000/auth/linkedin/callback?error=unauthorized_scope_error&error_description=Scope+%26quot%3Br_liteprofile%26quot%3B+is +not+authorized+for+your+application&state=126bb5cb16613e67f77580954980f86e4a3080c7cb4e56fe

這顯然是在請求 r_liteprofile。現在由於 r_liteprofile 是不允許的,它會給出一個回調錯誤

OmniAuth::Strategies::OAuth2::CallbackError

<代碼>unauthorized_scope_error | 範圍“r_liteprofile” 沒有為您的應用程序授權

routes.rb 看起來像

get 'login‑linkedin', to: redirect('/auth/linkedin' )

get 'auth/:provider/callback', to: 'sessions#identify_network_entry'

omniauth.rb 看起來像

提供者 :linkedin, 'KEY', 'VALUE

Linkedin 控制台中 Oauth2.0 的回調 url 看起來像

http://localhost:3000/auth/linkedin/callback

是否有解決方法或者這是一個實施缺陷?這不再偶爾發生,所以我假設我正在犯一個實施錯誤。


參考解法

方法 1:

Today (jan 14th) linkedin transitioned their docs and allowed for all applications created after today to automatically be able to use r_liteprofile under the self serve section, but to use the r_basicprofile you'll have to apply to their partner program.

Connecting to the v1 API with r_basicprofile should work, but only until march 1st.

Perhaps your issue was happening because of the switch that took place.

Read more here:

https://docs.microsoft.com/en‑us/linkedin/consumer/integrations/self‑serve/migration‑faq?context=linkedin/consumer/context

All new applications created on the LinkedIn Developer Platform as of January 14, 2019 can use LinkedIn's v2 APIs.

Specifically...

What permissions do I have access to?

LinkedIn v1 APIs provided the following set of permissions:

r_basicprofile r_emailaddress w_share rw_company_admin

Moving forward, the available v2 APIs include:

r_liteprofile (replaces r_basicprofile) r_emailaddress w_member_social (replaces w_share)

and ...

Looking to maintain access to the Basic Profile fields? Learn more about applying to a LinkedIn Partner Program.

(by Himanshu Guptaamurrell)

參考文件

  1. Linkedin oauth2 r_liteprofile not being returned from api (CC BY‑SA 2.5/3.0/4.0)

#linkedin #omniauth-linkedin #linkedin-api #ruby-on-rails-5 #omniauth






相關問題

php中需要LinkedIn類型的朋友連接 (LinkedIn type friends connection required in php)

我可以在沒有明確用戶批准的情況下獲得 Linkedin oauth 訪問令牌嗎? (Could I get Linkedin oauth access token without explicitly user approve?)

Rails 3 Linkedin API 寶石 (Rails 3 Linkedin API gem)

如何在 iOS SDK 中獲取 LinkedIn 連接/朋友/聯繫人? (How to fetch LinkedIn connections/Friends/Contacts in iOS SDK?)

Linkedin 應用程序具有 OAuth 用戶令牌和 OAuth 用戶密鑰,它們會過期嗎? (Linkedin Application has OAuth User Token and OAuth User Secret, Do they Expire?)

LinkedIn 獲取個人資料提要或新聞提要 2015 (LinkedIn get profile feed or news feed 2015)

OAuth2::LinkedIn 錯誤 (OAuth2::Error with LinkedIn)

如果 Android 中未安裝 LinkedIn 本機應用程序,如何使用 LinkedIn 登錄和發布? (How to login and post with LinkedIn if LinkedIn native app is not installed in android?)

使用 JS API 集成 LinkedIn 登錄 (Integrate LinkedIn login using JS API)

Linkedin oauth2 r_liteprofile 沒有從 api 返回 (Linkedin oauth2 r_liteprofile not being returned from api)

LinkedIn OAuth2.0 使會話無效/強制重新授權 (LinkedIn OAuth2.0 Invalidate Session / Force re-authorization)

LinkedIn API v2 獲取用戶信息 (LinkedIn API v2 get user info)







留言討論