我正在尝试使用identityserver4构建身份提供程序应用程序;目前,我正在使用“资源所有者密码凭据”流,它从令牌 endpoints 返回access_token和refresh_token .
Code Snippet for calling TokenEndpoint from Client
var tokenClient = new TokenClient(<TokenEndpoint>, <ClientId>, <ClientSecret>);
var tokenResponse = await tokenClient.RequestResourceOwnerPasswordAsync(<UserName>, <password>, <Scopes>);
我的问题是,如何通过使用相同的“资源所有者密码凭据”流程获得“id_token”以及“access_token”和“refresh_token”?
1 回答
你没有 .
在IdentityServer4中,资源所有者密码凭据流仅提供访问令牌 . 如果您还需要id令牌,请使用授权码流,隐式代码流或混合流 .
由于您需要所有三种令牌类型,并且由于您似乎使用服务器端代码,因此授权码流最适合 . Some kinds of Hybrid Flow也适合你 .
From the docs:
From a GitHub issue: