Identity Server 4 演示返回无效的 ClientId

Identity Server 4 Demo returning Invalid ClientId

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

我在 Mid-May 中测试了与 Identity Server 4 演示版的集成,我可以确认一切正常。我在公司内部的演示中使用了它session。

但是今天再测试的时候,运行出现了上面的错误

这是我在 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 存储库下载了最新的 samples/QuickStart。我测试了 Quickstarts 文件夹中的 3_AspNetCoreAndApis 解决方案并得到了相同的 unauthorized_client 错误。

有没有人在用这个演示服务器做测试?我想,Idsv 演示服务器设置最近一定发生了一些变化。

请问我应该使用哪个 client_id / secret 来使用 Demo Identity Server 来测试外部身份验证提供程序?谢谢。

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

这是今天的工作代码:

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";
            });

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