Hello @Milos@Signum,
Thank you for posting your query on Microsoft Q&A.
Understood that you're encountering the error "AADSTS501461: AcceptMappedClaims is only supported for a token audience matching the application GUID or an audience within the tenant's verified domains." This error indicates an issue with the token's audience claim requested by your Single Page Application (SPA).
It can occur for several reasons, especially after changes to the application registration, like adding app owners or modifying user assignments.
Here are few approaches to troubleshoot and resolve the issue:
1.Verify Application Registration Settings:
· Ensure the API app’s Application ID URI matches the resource identifier requested by the SPA.
· Confirm the SPA app is requesting the correct API scopes (formatted as api://<client-id>/<scope-name>).
2.Check Token Configuration:
· In the API app’s “Token configuration,” verify the audience claim and ensure optional claims are set correctly without conflicts.
3.User Assignment:
· Confirm users are assigned to the SPA app if required and have the necessary permissions in the “Users and groups” section.
4.Review Conditional Access Policies:
· Check for policies that could block access or alter claims; ensure users meet all conditions, like MFA or device compliance.
5.Compare CI and UAT Environments:
· Identify discrepancies in configurations, permissions, or assignments between CI and UAT environments.
6.Check for Azure AD Changes:
· Review recent changes in Azure AD (e.g., app owner adjustments or user assignments) that may affect the app registration. Check audit logs for any clues.
7.Testing with Different Users:
· Test with multiple users to determine if the issue is user-specific or affects all users.
8.Recreate the App Registration:
· As a last resort, recreate the app registration for both the SPA and API to eliminate any potential misconfigurations.
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".