【问题标题】:Identity Server 4 Demo returning Invalid ClientIdIdentity Server 4 Demo 返回无效的 ClientId
【发布时间】:2022-03-31 15:15:29
【问题描述】:

我正在尝试使用身份服务器 4 (https://demo.identityserver.io/) 的演示版作为外部身份验证提供程序,但它不再工作了。我不断收到 unauthorized_client 错误如下:

我在 5 月中旬测试了与 Identity Server 4 演示版的集成,我可以确认一切正常。我在公司内部的演示会议中使用了它。

但是今天再次测试时,遇到了上述错误。

这是我在 5 月份正常工作的原始代码:

        .AddOpenIdConnect("demoidsrv", "IdentityServer", options =>
        {
            options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
            options.SignOutScheme = IdentityServerConstants.SignoutScheme;

            options.Authority = "https://demo.identityserver.io/";
            options.ClientId = "implicit";
            options.ResponseType = "id_token";
            options.SaveTokens = true;

            options.Scope.Add(IdentityServerConstants.StandardScopes.OpenId);
            options.Scope.Add(IdentityServerConstants.StandardScopes.Profile);
            options.Scope.Add(IdentityServerConstants.StandardScopes.Email);

            options.CallbackPath = "/signin-idsrv";
            options.SignedOutCallbackPath = "/signout-callback-idsrv";
            options.RemoteSignOutPath = "/signout-idsrv";
        });  

我尝试应用在线文档Online Docs 中的最新代码。但我仍然有同样的错误。

.AddOpenIdConnect("oidc", "Demo IdentityServer", options =>
    {
        options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
        options.SignOutScheme = IdentityServerConstants.SignoutScheme;
        options.SaveTokens = true;

        options.Authority = "https://demo.identityserver.io/";
        options.ClientId = "native.code";
        options.ClientSecret = "secret";
        options.ResponseType = "code";

        options.TokenValidationParameters = new TokenValidationParameters
        {
            NameClaimType = "name",
            RoleClaimType = "role"
        };
    });    

所以,我从身份服务器 4 QuickStart 的 Github 存储库下载了最新的示例/快速入门。我测试了 Quickstarts 文件夹中的 3_AspNetCoreAndApis 解决方案,得到了同样的 unauthorized_client 错误。

有没有人使用这个演示服务器进行测试?我认为,最近 Idsv 演示服务器设置中一定发生了一些变化。

您能否帮我使用哪个 client_id / secret 来使用 Demo Identity Server 来测试外部身份验证提供程序?谢谢。

【问题讨论】:

  • clientId/secret 应该是 demo.identityserver.io 上列出的项目之一。你所拥有的与他们中的任何一个都不匹配。如果有机会,我明天会亲自为你验证。

标签: c# identityserver4


【解决方案1】:

这是因为 Identity Server 团队最近更改了 clientId、凭据和机密。

这是截至今天的工作代码:

services.AddAuthentication()                
            .AddOpenIdConnect("demoidsrv", "IdentityServer", options =>
            {
                options.SignInScheme = IdentityServerConstants.ExternalCookieAuthenticationScheme;
                options.SignOutScheme = IdentityServerConstants.SignoutScheme;

                options.Authority = "https://demo.identityserver.io/";
                options.ClientId = "login";
                options.ResponseType = "id_token";
                options.SaveTokens = true;

                options.Scope.Add(IdentityServerConstants.StandardScopes.OpenId);
                options.Scope.Add(IdentityServerConstants.StandardScopes.Profile);
                options.Scope.Add(IdentityServerConstants.StandardScopes.Email);

                options.CallbackPath = "/signin-aholdibm";
                options.SignedOutCallbackPath = "/signout-callback-idsrv";
                options.RemoteSignOutPath = "/signout-idsrv";
            });

【讨论】:

    【解决方案2】:

    如果有人来这里是因为 demo.identityserver.io 不再适用于示例,那是因为他们将其移至 demo.duendesoftware.com

    【讨论】:

      猜你喜欢
      • 2021-01-22
      • 1970-01-01
      • 2020-03-24
      • 2018-09-19
      • 2020-07-18
      • 1970-01-01
      • 1970-01-01
      • 2018-06-27
      • 2020-06-05
      相关资源
      最近更新 更多