【问题标题】:Linkedin Omniauth gem 'omniauth-linkedin-oauth2' giving Authentication failure! invalid_credentials: OAuth2::ErrorLinkedin Omniauth gem 'omniauth-linkedin-oauth2' 验证失败! invalid_credentials: OAuth2::Error
【发布时间】:2020-07-03 11:19:28
【问题描述】:

我有一个应用程序在成功运行 GoogleFacebook 全方位身份验证。我也想用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


    【解决方案1】:

    删除范围和字段,然后试试这个:

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

    【讨论】:

    • 谢谢,这意味着我们必须同时删除 scopefields 才能完成这项工作。
    猜你喜欢
    • 1970-01-01
    • 2012-08-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-07-11
    相关资源
    最近更新 更多