IdentityServer4.Admin icon indicating copy to clipboard operation
IdentityServer4.Admin copied to clipboard

User Claims not added to token even if Always Include User Claims In IdToken is set

Open Franklin89 opened this issue 4 years ago • 2 comments

I have some custom User Claims on a user and I set the User Claims not added to token even if Always Include User Claims In IdToken to true. I expected that now these claims will be part of the token. But they are missing.

If I add the claim name (in my case initials) to the Profile Identity Resource I receive the claim in the token.

I have only worked with a ID4 server directly without the Admin UI before. There I created my own profile service and added the claims. And when I set AlwaysIncludeUserClaimsInIdToken = true in the Client config I got my User Claim.

Does Admin UI Work differently here?

Thanks for all the work you put in this...

Franklin89 avatar Dec 08 '20 15:12 Franklin89

In order to receive the claims in your client you still need an Identity Resource with the custom claims you created and add a scope to your client that matches it. Did you do that? The fact that when you add the claim to an existing Identity Resource it works makes me think you're just missing that step.

aiscrim avatar Jan 20 '21 12:01 aiscrim

@aiscrim I added user claims to "openid" identity resource as you said and it worked. Thank you for your comment, it helps me a lot.

amin-norollah avatar Jun 15 '22 05:06 amin-norollah