Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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", "[email protected]"),
     new Claim("website", "https://bob.com"),
     new Claim("idade", "25 anos"),
     new Claim("jogo-favorito", "nier-automata")
   }
 }
};

Sorry for the bad English.

like image 368
Leonardo Oliveira Avatar asked Nov 02 '25 02:11

Leonardo Oliveira


1 Answers

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"}
like image 143
Hussein Salman Avatar answered Nov 03 '25 17:11

Hussein Salman



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!