【问题标题】:How to get id_token from TokenEndpoint of IdentityServer4 through authorization_code flow?如何通过authorization_code流程从IdentityServer4的TokenEndpoint获取id_token?
【发布时间】:2017-05-19 21:05:02
【问题描述】:

我想通过授权码流从令牌端点获取“access_token”和“id_token”。但是,在邮递员上使用以下参数调用令牌端点时出现“invalid_grant”错误。

POST /connect/token HTTP/1.1
Host: localhost:2000
Content-Type: application/x-www-form-urlencoded
Cache-Control: no-cache
Postman-Token: a8a29659-0ea3-e7dc-3bd6-6e6630a7370d

client_id=client
&client_secret=client
&grant_type=authorization_code
&username=admin
&password=admin
&scope=openid+profile

客户端配置:

new Client
{
   ClientId = "client",
   ClientSecrets =
   {
     new Secret("client".Sha256())
   },
   AllowedGrantTypes = new List<string> { OidcConstants.GrantTypes.AuthorizationCode },
   AllowedScopes = {
     StandardScopes.OpenId.Name,
     StandardScopes.Profile.Name,
   }
}

我的客户端配置部分有什么问题?以及,如何向 Token Endpoint 发出成功的 post 请求?

【问题讨论】:

    标签: asp.net-core openid-connect identityserver4


    【解决方案1】:

    授权码授予类型需要在令牌请求期间发送code 参数(请参阅RFC6749 section 4.1.3)。

    此代码由资源所有者授权客户端后由授权服务器发布(参见RFC6749 section 4.1.2)。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-05-19
      • 2021-01-27
      • 2021-12-18
      • 1970-01-01
      • 2019-01-24
      • 2019-04-19
      • 2017-07-25
      • 1970-01-01
      相关资源
      最近更新 更多