【问题标题】:signoutRedirect of oidc-client-js against Auth0 returns no end session endpointoidc-client-js 针对 Auth0 的 signoutRedirect 不返回结束会话端点
【发布时间】:2018-11-23 11:10:34
【问题描述】:

我已成功使用 Brock Allen 的 oidc-client-js 库来验证我的 SPA 应用程序,其中 Auth0 作为我的身份提供者。但是,当我尝试使用库将用户注销 mgr.signoutRedirect({state: "my test"}) 时,我收到一个错误:no end session endpoint

查看metadata endpoint 表明存在撤销端点。

我已经像这样配置了 oidc-client-js 库:

var settings = {
   authority: 'https://susqsofttest.auth0.com/.well-known/openid-configuration',
   client_id: 'my client id',
   redirect_uri: 'http://localhost:8080/signin-oidc',
   post_logout_redirect_uri: 'http://localhost:8080/logout',
   response_type: 'id_token token',
   scope: 'openid profile email',
   revokeAccessTokenOnSignout: true,
   automaticSilentRenew: true,
   filterProtocolClaims: true,
   loadUserInfo: true
};
var mgr = new UserManager(settings);

关于我缺少什么的任何想法?

【问题讨论】:

    标签: auth0 oidc-client-js


    【解决方案1】:

    您可以通过将元数据部分添加到用户管理器设置来为 oidc 客户端提供元数据。

    var settings = {
    authority: 'https://susqsofttest.auth0.com/.well-known/openid-configuration',
    client_id: 'my client id',
    redirect_uri: 'http://localhost:8080/signin-oidc',
    post_logout_redirect_uri: 'http://localhost:8080/logout',
    response_type: 'id_token token',
    scope: 'openid profile email',
    revokeAccessTokenOnSignout: true,
    automaticSilentRenew: true,
    filterProtocolClaims: true,
    loadUserInfo: true,
    metadata: {
      issuer: `https://sts.windows.net/${tenant}/`,
      authorization_endpoint: `https://login.microsoftonline.com/${tenant}/oauth2/authorize`,
      token_endpoint: `https://login.microsoftonline.com/${tenant}/oauth2/token`,
      jwks_uri: 'https://login.microsoftonline.com/common/discovery/keys',
      end_session_endpoint: `https://login.microsoftonline.com/${tenant}/oauth2/logout`
    }
    };
    

    此示例是在使用 AzureAD 时。 end_session_endpoint 也可以是您的 SPA 路由地址,例如 ${window.location.origin}/logout,但 azure 广告会话不会结束。

    您还可以设置 metadataUrl 来代替元数据。 'https://login.microsoftonline.com/YOUR_TENANT_NAME.onmicrosoft.com/.well-known/openid-configuration',

    【讨论】:

      【解决方案2】:

      signout 重定向明确查看您的 idp configuration 中的 Json 属性“end_session_endpoint”,我在您的 idp 配置中看不到该端点,我猜,这不是您可以用 oidc-client.js 覆盖的东西包裹。

      查看他们如何从元数据中检索端点 URL。 https://github.com/IdentityModel/oidc-client-js/blob/dev/src/OidcClient.js#L124

      【讨论】:

        猜你喜欢
        • 2019-11-23
        • 2016-10-21
        • 2021-07-20
        • 2021-01-01
        • 2018-08-19
        • 1970-01-01
        • 1970-01-01
        • 2019-12-05
        • 1970-01-01
        相关资源
        最近更新 更多