Hi @Nirmala D · Thank you for reaching out.
You can NOT get UPN in the token the you acquired by using Client_Credentials flow, because when this flow is used, authentication is done under application context and not under user context. As UPN is a user attribute and not application attribute, it will not be returned in the token acquired in application context.
If you need UPN claim in the token, you will need to use one of the below authentication flows to acquire token under user context:
- Authorization code flow - https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
- ROPC flow - https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth-ropc
- Implicit flow - https://learn.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-implicit-grant-flow
-----------------------------------------------------------------------------------------------------------
Please "Accept the answer" if the information helped you. This will help us and others in the community as well.