Hi @Johannes T,
Based on your query, here is my understanding: you have added preferred_username
as an optional claim which has not passed in token.
Preferred_username
claim is mutable which cannot be used for any authorization decisions and is only available for the users when you use v2.0
token. This claim is availble for the application when you have scope as profile
for your application.
In order to receive the token with preferred_username you may need to use this endpoint:
- Well-known configuration document path:
/.well-known/openid-configuration
- Authority URL:
https://login.microsoftonline.com/{tenant}/v2.0
- v2.0:
https://login.microsoftonline.com/common/oauth2/v2.0/authorize
The profile
scope: The profile
scope can be used with the openid
scope and any other scope. It gives the app access to a large amount of information about the user. The information it can access includes, but not limited to, the user's given name, surname, preferred username, and object ID.
Additional information:
ID tokens in the Microsoft identity platform
Scopes and permissions in the Microsoft identity platform
v1.0 and v2.0 optional claims set
I hope this information is helpful. Please feel free to reach out if you have any further questions.
If the answer is helpful, please click "Accept Answer" and kindly "upvote it". If you have extra questions about this answer, please click "Comment".