Gary Bushey
Gary Bushey

Reputation: 121

Identityserver4 return custom values userinfo endpoint

Should IdentityServer4's UserInfo endpoint return all the claims that I have in my ASPNetUserClaims table for a given user or do I need some special configuration to get them? Right now I am only seeing the default values being returned and before I waste a lot of time trying to get this to work with my custom values I want to make sure I am not doing something wrong. Worse case I can use some of the other existing entries to store my data (challenge question and response) but I would prefer to store them using those names (rather than in fields like middle_name and nickname for instance)

Upvotes: 0

Views: 1774

Answers (1)

rawel
rawel

Reputation: 3033

According to documentation, The caller needs to send a valid access token representing the user. Depending on the granted scopes, the UserInfo endpoint will return the mapped claims (at least the openid scope is required)

The proper way to get your custom claims is to

  1. [in IdentityServer configuration] Add the custom claim types to a scope(resource) and add that scope to allowed scopes list of the client.
  2. [in Client]Request that scope(resource) from your client.

If you add your identity server configuration and client configuration to the question it will help you to get more specific answer.

Upvotes: 2

Related Questions