简体   繁体   中英

identity server 4 does not show all user claims

I'm using IdentityServer4 and everything is fine until I log in with some user, where all my user data does not appear.

When entering a TestUser with the name, email, website, age, game-favorite Claims, it only displays the name and website.

how do I display all the variants my user has?

return new List < TestUser > {
 new TestUser {
  SubjectId = "2",
   Username = "bob",
   Password = "password",
   Claims = new [] {
    new Claim("name", "Bob Asterman"),
     new Claim("e-mail", "bobasterman@gmail.com"),
     new Claim("website", "https://bob.com"),
     new Claim("idade", "25 anos"),
     new Claim("jogo-favorito", "nier-automata")
   }
 }
};

Sorry for the bad English.

The Claim idade is not included by default. you need to introduce this as a custom claim by adding it your Scopes in GetScopes method in the config.cs:

Then, you have to add this new scope to your Client using AllowedScopes Property in Config .cs example:

AllowedScopes = { "idade"}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM