简体   繁体   English

Linkedin Omniauth gem 'omniauth-linkedin-oauth2' 验证失败:invalid_credentials: OAuth2::Error

[英]Linkedin Omniauth gem 'omniauth-linkedin-oauth2' giving Authentication failure! invalid_credentials: OAuth2::Error

I have an application running with successful Google and Facebook omniauthentication running.我有一个应用程序运行成功的谷歌Facebook全方位身份验证运行。 I want to add Linkedin Login too with omniauth.我也想用omniauth添加Linkedin登录。 All seems to fine until I request the email address by adding :scope => 'r_emailaddress' to the line一切似乎都很好,直到我通过添加:scope => 'r_emailaddress'来请求email 地址

devise.rb devise.rb

  config.omniauth :linkedin, ENV['LINKEDIN_CLIENT_ID'], ENV['LINKEDIN_CLIENT_SECRET'], :scope => 'r_emailaddress', :fields => ['email', 'id', 'first-name', 'last-name']

All seems to be correct if I removed the r_emailaddress and add any other scope like r_liteprofile as如果我删除r_emailaddress并添加任何其他 scope (如r_liteprofile ),一切似乎都是正确的

  config.omniauth :linkedin, ENV['LINKEDIN_CLIENT_ID'], ENV['LINKEDIN_CLIENT_SECRET'], :scope => 'r_liteprofile', :fields => ['email', 'id', 'first-name', 'last-name']

Gemfile宝石文件

gem 'omniauth-linkedin-oauth2'

The error is coming up in the backend and in the front end after successfully putting all the credentials on the Linkedin page, the app is redirecting to the home page and not giving any error in the UI.成功将所有凭据放在Linkedin页面上后,后端和前端出现错误,应用程序重定向到主页并且在UI中没有给出任何错误。

The error it's throwing in the logs is它在日志中抛出的错误是

ERROR -- omniauth: (linkedin) Authentication failure! invalid_credentials: OAuth2::Error, : 
{"serviceErrorCode":100,"message":"Not enough permissions to access: GET /me","status":403}

It would be great if anyone can help me in this matter.如果有人能在这件事上帮助我,那就太好了。

Remove scope and fields both and try this:删除 scope 和字段,然后试试这个:

config.omniauth :linkedin, ENV['LINKEDIN_CLIENT_ID'], ENV['LINKEDIN_CLIENT_SECRET']

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 获得“身份验证失败! invalid_credentials:OAuth2 :: Error“用于自定义omniauth策略 - Getting “Authentication failure! invalid_credentials: OAuth2::Error” for custom omniauth strategy Omniauth与Linkedin Oauth2 - Omniauth with Linkedin Oauth2 omniauth_openid_connect gem - 身份验证失败:invalid_request: Rack::OAuth2::Client:,Error: invalid_request:: 客户端凭据无效 - omniauth_openid_connect gem - Authentication failure! invalid_request: Rack::OAuth2::Client::Error, invalid_request :: Client credentials are invalid gem'omniauth-stripe-connect' - 身份验证失败,invalid_credentials,invalid_grant - gem 'omniauth-stripe-connect'-Authentication failure, invalid_credentials, invalid_grant omniauth 身份验证/失败消息=invalid_credentials - omniauth auth/failure message=invalid_credentials omn​​iauth-password给出invalid_credentials错误 - omniauth-password giving invalid_credentials error 验证失败! invalid_credentials:OAuth ::未经授权,需要401授权 - Authentication failure! invalid_credentials: OAuth::Unauthorized, 401 Authorization Required Facebook,LinkedIn和Google的Oauth2登录已停止使用Devise和Omniauth,但仍适用于LinkedIn和Twitter - Oauth2 Login for Facebook, Linkedin and Google Stopped Working with Devise and Omniauth, But Still Works for LinkedIn and Twitter OAuth2 :: LinkedIn发生错误 - OAuth2::Error with LinkedIn devise + omniauth auth / failure?message = invalid_credentials - devise + omniauth auth/failure?message=invalid_credentials
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM