0

I am following this post to implement IdentityServer4. I have problem that in ProfileService in procedure GetProfileDataAsync IEnumerable context.RequestedClaimTypes is empty. Should I change my request in Postman to request certain claim types? What can I do so that context.RequestedClaimTypes contains claim types?

My Postman request looks like this:

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
Uros
  • 2,099
  • 7
  • 23
  • 50

1 Answers1

1

just like the post you followed, you have to request it in your scope . You can add profile email to it and then you should get those claims. make sure you add them in the client configuration (config.cs) under AllowedScopes as well.

JayDeeEss
  • 1,075
  • 9
  • 14
  • That almost entirely solved my problem. Name and email are available in context.RequestedClaimTypes, but subject is still not available. I added JwtClaimTypes.Subject to UserClaims. To Scopes I added "my_api", "openid", "profile", "email". In Client, I added AllowedScopes: "my_api", "openid", "profile", "email", "sub". In Postman, scope contains "my_api openid profile email". – Uros Aug 09 '17 at 09:04
  • JwtClaimTypes.Subject ("sub") claim will be included in User.Claims in API by default. – Uros Aug 09 '17 at 09:46