【问题标题】:Ruby on Rails 4 - Authentication with Linkedin and OmniAuthRuby on Rails 4 - 使用 Linkedin 和 OmniAuth 进行身份验证
【发布时间】:2019-09-11 13:25:31
【问题描述】:

我正在尝试使用我的 Rails 应用设置 LinkedIn 身份验证。它使用设计和omniauth(使用omniauth-linkedin-oauth2)。

我需要一些帮助,因为信息不正确,例如用户的公共 URL。有人可以指出正确的过程,但不是他们文档中的内容,正如我所尝试的那样,它不起作用。谢天谢地。

【问题讨论】:

    标签: oauth-2.0 linkedin omniauth


    【解决方案1】:

    文档说您需要将r_basicprofile 添加到您的请求中。你可以通过设计初始化器来做到这一点

    config.omniauth :omniauth-linkedin-oauth2, CLIENT_KEY, CLIENT_SECRET, scope: r_basicprofile
    

    这样,您应该可以访问身份验证哈希中的 public-profile-url 键。

    LinkedIn Docs

    【讨论】:

    • 如果没有特殊的linkedin 授权,就会出现这个错误: 错误——omniauth: (linkedin) 身份验证失败! invalid_credentials: OAuth2::Error, : {"serviceErrorCode":100,"message":"没有足够的权限访问:GET /me","status":403}
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-26
    • 2013-10-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2018-09-23
    相关资源
    最近更新 更多