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

gblwokeq  于 2023-04-10  发布在  其他
关注(0)|答案(1)|浏览(201)

我使用的是Identity Server 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()) }
            }

Postman的Auth 2.0流程如下:
https://i.stack.imgur.com/2tkO5.png
并获得“invalid_client”错误,如下图所示(https://i.stack.imgur.com/OMvLI.png
如下所示的请求(也尝试添加client_secret):(https://i.stack.imgur.com/qCum1.png
给了我同样的“invalid_client”错误,现在我被这个卡住了,auth流程没有pkce。

41ik7eoe

41ik7eoe1#

无效客户端意味着错误的客户端名称或客户端密码。

ClientId = "ClientId",
                ClientName = "ClientName",
                ClientSecrets = new List<Secret> {new Secret("secret".Sha256())},


id为“ClientId”,首字母大写,Secret为“secret”

相关问题