【发布时间】:2020-07-03 11:19:28
【问题描述】:
我有一个应用程序在成功运行 Google 和 Facebook 全方位身份验证。我也想用omniauth添加Linkedin登录。一切似乎都很好,直到我通过将 :scope => 'r_emailaddress' 添加到该行来请求 电子邮件地址
devise.rb
config.omniauth :linkedin, ENV['LINKEDIN_CLIENT_ID'], ENV['LINKEDIN_CLIENT_SECRET'], :scope => 'r_emailaddress', :fields => ['email', 'id', 'first-name', 'last-name']
如果我删除 r_emailaddress 并添加任何其他范围(如 r_liteprofile 作为
),一切似乎都是正确的 config.omniauth :linkedin, ENV['LINKEDIN_CLIENT_ID'], ENV['LINKEDIN_CLIENT_SECRET'], :scope => 'r_liteprofile', :fields => ['email', 'id', 'first-name', 'last-name']
宝石文件
gem 'omniauth-linkedin-oauth2'
成功将所有凭据放在Linkedin页面上后,后端和前端出现错误,应用程序重定向到主页并且UI中没有任何错误。
它在日志中抛出的错误是
ERROR -- omniauth: (linkedin) Authentication failure! invalid_credentials: OAuth2::Error, :
{"serviceErrorCode":100,"message":"Not enough permissions to access: GET /me","status":403}
如果有人能在这件事上帮助我,那就太好了。
【问题讨论】:
标签: ruby-on-rails ruby linkedin omniauth omniauth-linkedin