这些用户声明很可能出现在ID令牌中。要让这一切顺利进行,请检查您是否
AlwaysIncludeUserClaimsInIdToken = true
在IDP提供商的客户端配置中,如
public static IEnumerable<Client> GetClients()
{
return new List<Client>()
{
new Client()
{
ClientName = "IDP Client",
ClientId = "client",
ClientSecrets = { new Secret("secret".Sha256()) },
AllowedGrantTypes = GrantTypes.Hybrid,
RedirectUris = new List<string>()
{
"http://localhost:60811/signin-oidc"
},
AllowedScopes =
{
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
"myapi"
},
AlwaysIncludeUserClaimsInIdToken = true,
AllowOfflineAccess = true
},