【发布时间】:2021-04-10 08:34:44
【问题描述】:
我正在将 IdentityServer4 IDP 与 blazor 客户端一起使用。在剃须刀组件中,我有:
[CascadingParameter]
public Task<AuthenticationState> AuthenticationStateTask { get; set; }
async Task GetClaims()
{
var claims = (await AuthenticationStateTask).User.Claims;
}
这给了我总共 9 个声明,包括 sub、name、preferred_name、amr、email、email_verified 等。我也想在这里获取电话号码,但不是即使我在 IDP 配置中添加电话范围如下
public static IEnumerable<IdentityResource> Ids =>
new IdentityResource[]
{
new IdentityResources.OpenId(), // sub
new IdentityResources.Profile(), // givenName, familyName ..
new IdentityResources.Email(),
new IdentityResources.Phone()
};
在客户端对象中;
AllowedScopes = {
IdentityServerConstants.StandardScopes.OpenId,
IdentityServerConstants.StandardScopes.Profile,
IdentityServerConstants.StandardScopes.Email,
IdentityServerConstants.StandardScopes.Phone,
"exampleapi" },
这不是说电话号码应该在身份令牌中吗?我应该怎么做才能得到电话号码?
另外,发送phoneNumberUpdate 请求的最佳方式是什么?
【问题讨论】:
标签: c# asp.net blazor identityserver4