如何在 IdentityServer4 中请求声明类型?
How to request claim types in IdentityServer4?
我正在关注此 以实施 IdentityServer4。我有问题,在 ProfileService 中,过程 GetProfileDataAsync IEnumerable context.RequestedClaimTypes 是空的。我是否应该将我在 Postman 中的请求更改为请求某些索赔类型?我该怎么做才能使 context.RequestedClaimTypes 包含声明类型?
我的 Postman 请求如下所示:
Post http://localhost:57577/connect/token
Authorization: Basic Z2xvYmFsX2F...
Body (x-www-form-urlencoded):
username:user@gmail.com
password:pass
grant_type:password
scope:my_api
就像您关注的 post 一样,您必须在 scope
中请求它。您可以向其中添加 profile email
,然后您应该得到这些声明。确保将它们也添加到 AllowedScopes
下的客户端配置 (config.cs) 中。
我正在关注此
我的 Postman 请求如下所示:
Post http://localhost:57577/connect/token
Authorization: Basic Z2xvYmFsX2F...
Body (x-www-form-urlencoded):
username:user@gmail.com
password:pass
grant_type:password
scope:my_api
就像您关注的 post 一样,您必须在 scope
中请求它。您可以向其中添加 profile email
,然后您应该得到这些声明。确保将它们也添加到 AllowedScopes
下的客户端配置 (config.cs) 中。