Identity Server 4 - 无法验证用户身份

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

我有以下客户:

 new Client
 {
    RequirePkce = false,
    AllowAccessTokensViaBrowser = true,
    ClientId = "client_id_mobile",
    ClientSecrets =
    {
      new Secret("client_secret_mobile".Sha256())
    },
    AllowedGrantTypes = GrantTypes.ResourceOwnerPassword,
    AllowedScopes =
    {
      IdentityServerConstants.StandardScopes.OpenId,                    
    },
    RedirectUris = new []
    {
      "https://www.getpostman.com/oauth2/callback"
    },
  }

我正在尝试通过在邮递员中执行以下操作来验证用户身份:

enter image description here

但正如你所看到的,我得到了

unsupported_grant_type
,我尝试将拨款类型更改为
code
,然后我得到了
unauthorized_client

任何人都可以指出我在这里做错了什么吗?

c# authentication oauth-2.0 identityserver4 openid
2个回答
0
投票

对于新开发,您应该只考虑使用授权代码流程或客户端凭据流程。自 OAuth2.1 起,所有其他流程均已弃用。

如果您想使用用户名/密码登录并且不涉及任何用户,请改用客户端凭据流程。

我在这篇文章中写了一篇关于流程的文章OpenID Connect for Developers


0
投票

根据 OAuth2.1 规范,授权代码授予应支持 PKCE,但许多服务器根据 OAuth2.0 支持授权授予。您可以尝试其中任何一种。

最新问题
© www.soinside.com 2019 - 2025. All rights reserved.