[英]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.