I have activated the declarative-user-profile and added a property called ‘country,’ which I have enabled for the ‘email’ scope. Can I retrieve the value of ‘country’ via /realms/MYREALM/protocol/openid-connect/userinfo?
For your information, I have tested by generating a token with the ‘email’ scope, but I cannot retrieve ‘country’ by calling /realms/MYREALM/protocol/openid-connect/userinfo.
You will have to create a mapper, that your desired user attribute will get mapped to the token.
As you are using the email scope, you should add the mapper to the email client scope configuration.
What type of mapper should I create? I tried unsuccessfully with ‘User Property’ and ‘User Attribute.’
I set: “User Attribute”: “country”, “Token Claim Name”: “country”, and checked “Add to userinfo” but when I call /realms/MYREALM/protocol/openid-connect/userinfo there is no property country in the response. But country is a property of “User Profile” (flag declarative-user-profile).