Identity Server 4,在 auth 2.0(授权)工作流程中出现“invalid_client”错误

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

我正在使用身份服务器 4,需要让我的用户访问另一端。我已经在第三方网站上为 SSO 配置了我的应用程序,所以我的应用程序充当该第三方网站的服务提供商,具有 auth 2.0 流程。

new Client
            {
                ClientId = "ClientId",
                ClientName = "ClientName",
                ClientSecrets = new List<Secret> {new Secret("secret".Sha256())}, 
                AllowedGrantTypes = { GrantType.AuthorizationCode},
                RedirectUris = new List<string> { "https://pubhive.myfreshworks.com/sp/OAUTH/312319274297315477/callback" },
                AllowedScopes = new List<string>
                {
                    IdentityServerConstants.StandardScopes.OpenId,
                    IdentityServerConstants.StandardScopes.Profile,
                    IdentityServerConstants.StandardScopes.Email,
                },
                 AlwaysIncludeUserClaimsInIdToken = true,
                 AllowOfflineAccess = true,

                RequirePkce = false,
                AllowPlainTextPkce = false,
                  AlwaysSendClientClaims = true,
                 AccessTokenLifetime = 60*60
            }

我的 Api 来源

  new ApiResource("ClientId")
            {
                Scopes = new List<string>{ IdentityServerConstants.StandardScopes.OpenId,
                    IdentityServerConstants.StandardScopes.Profile,
                    IdentityServerConstants.StandardScopes.Email},
                UserClaims = new List<string>{ StandardScopes.Email},
                ApiSecrets = new List<Secret>{ new Secret("PubhiveAPISecretKey777".Sha256()) }
            }

以下来自邮递员的 Auth 2.0 流程:

并出现“invalid_client”错误,如下图所示

如下所示的请求(也尝试添加 client_secret):

给我同样的“invalid_client”错误,现在我坚持这个,auth flow is without pkce.

asp.net-core authentication oauth-2.0 single-sign-on identityserver4
2个回答
0
投票

你的配置没问题。您应该先点击底部的“获取新访问令牌”。然后使用此令牌进行进一步测试。不要点击“发送”来获取令牌。


0
投票

ClientId、clientSecret 和范围区分大小写,因此它们必须与您的客户端配置完全匹配。

© www.soinside.com 2019 - 2024. All rights reserved.