Rails设计Omniauth omniauth_openid_connect问题;总是得到'找不到。认证passthru`

问题描述 投票:0回答:1

对不起,如果我遗漏了一些非常基本的东西,但我认为我需要一些帮助,在我的应用程序中使用devise配置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和秘密

在这方面的任何帮助将受到高度赞赏!

ruby-on-rails devise omniauth openid-connect
1个回答
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", 
    }, 
  }
© www.soinside.com 2019 - 2024. All rights reserved.