Rails Devise Omniauth omniauth_openid_connect问题;总是得到`未找到。验证通过

时间:2019-04-11 04:27:24

标签: ruby-on-rails devise omniauth openid-connect

很抱歉,如果我缺少一些非常基本的知识,但是我想在我的应用程序中通过设计配置omniauth_openid_connect gem(https://github.com/m0n9oose/omniauth_openid_connect/)时需要一些帮助;我总是得到Not found. Authentication passthru。错误;

点击“使用OpenIdConnect登录”时设计的网址为:https://myapp.com/users/auth/openid_connect

我的配置如下config/initializers/devise.rb所示:

config.omniauth :openid_connect, 
{ 
    name: :openid_connect,
    scope: [:openid],
    response_type: :code,
    client_options:
    {
    port: 443,
    scheme: "https",
    host: "staging-oauth.provider.com",
    issuer: "https://staging-oauth.provider.com",
    authorization_endpoint: "/oauth2/auth", 
    token_endpoint: "/oauth2/token", 
    identifier: 'CLIENT_ID', 
    secret: 'CLIENT_SECRET', 
    redirect_uri: "https://myapp.com/users/auth/openid_connect/callback", 
    }, 
    }

我知道我已经在其中添加了额外的参数,但这是因为我不确定确切需要什么;我也看不到服务器上的任何日志,所以这意味着我没有击中正确的端点或其他东西

我有以下提供商提供的网址

发布者终结点(https://staging-oauth.provider.com

授权端点(https://staging-oauth.provider.com/oauth2/auth

令牌端点(https://staging-oauth.provider.com/oauth2/token

我也有客户ID和机密

在这方面的任何帮助将不胜感激!!

1 个答案:

答案 0 :(得分:0)

正确的配置:

config.omniauth :openid_connect, 
{ 
    name: :openid_connect,
    scope: [:openid],
    issuer: "https://staging-oauth.provider.com/"
    response_type: :code,
    discovery: :true,
    client_options:
    {
    port: 443,
    scheme: "https",
    host: "staging-oauth.provider.com",
    authorization_endpoint: "/oauth2/auth", 
    token_endpoint: "/oauth2/token", 
    identifier: 'CLIENT_ID', 
    secret: 'CLIENT_SECRET', 
    redirect_uri: "https://myapp.com/users/auth/openid_connect/callback", 
    }, 
  }