cod*_*.sj 11 openid-connect asp.net-core identityserver4
我正在尝试使用identityserver4构建身份提供程序应用程序; 目前,我正在使用"资源所有者密码凭据"流,它从令牌端点返回access_token和refresh_token.
用于从客户端调用TokenEndpoint的代码片段
var tokenClient = new TokenClient(<TokenEndpoint>, <ClientId>, <ClientSecret>);
var tokenResponse = await tokenClient.RequestResourceOwnerPasswordAsync(<UserName>, <password>, <Scopes>);
Run Code Online (Sandbox Code Playgroud)
我的问题是,如何通过使用相同的"资源所有者密码凭据"流程获得"id_token"以及"access_token"和"refresh_token"?
Sha*_*tin 15
如何通过使用相同的"资源所有者密码凭据"流程获得"id_token"以及"access_token"和"refresh_token"?
你没有.
在IdentityServer4中,资源所有者密码凭据流仅提供访问令牌.如果您还需要id令牌,请使用授权码流,隐式代码流或混合流.
access_token id_token refresh_token
Resource Owner Password Credentials yes - yes
Authorization Code yes yes yes
Implicit Flow yes yes -
Run Code Online (Sandbox Code Playgroud)
由于您需要所有三种令牌类型,并且由于您似乎使用服务器端代码,因此授权码流最适合.某些Hybrid Flow也适合您.
来自文档:
OAuth 2.0资源所有者密码授予允许客户端向令牌服务发送用户名和密码,并获取代表该用户的访问令牌.
OpenID Connect不指定资源所有者流 - 仅授权服务器上的交互式登录(如代码或隐式流).所以[换句话说,]没有身份令牌 - 只能访问令牌.
| 归档时间: |
|
| 查看次数: |
3614 次 |
| 最近记录: |