Hello Parth Jagani
Welcome to the Microsoft Q&A.
I understand that you would like to fix this > Message: AADSTS500207: The account type can't be used for the resource you're trying to access.
- If you are requesting tokens for a protected API, the first thing to check is your authority configuration. Make sure you are using the CIAM tenant-specific authority with v2.0, such as: https://{tenantSubdomain}.ciamlogin.com/{tenantId}/v2.0 If you miss the/v2.0 suffix or use the workforce endpoint (
login.microsoftonline.com), your request will fail with 500207. See Microsoft docs in this link - https://learn.microsoft.com/en-us/entra/external-id/customers/overview-customers-ciam - Another important step is to review the API app registration settings. For custom scopes to work in Entra External ID, the resource API app must be single-tenant. In the Azure portal, go to your API’s app registration, and under Supported account types, select Accounts in this organizational directory only (AzureAD MyOrg). Then under Expose an API, define your scope (e.g.,api://{api-client-id}/access_as_user`) and grant the client app permission to use it. - https://learn.microsoft.com/en-us/entra/identity-platform/quickstart-configure-app-expose-web-apis
- On the client app registration (your Flutter app - flutter_appauth), add this custom scope under API permissions, then in your code ensure the token request includes:
final result = await appAuth.authorizeAndExchangeCode(AuthorizationTokenRequest('{clientId}','{redirectUrl}',discoveryUrl: 'https://{tenantSubdomain}.ciamlogin.com/{tenantId}/v2.0/.well-known/openid-configuration?p={userFlowId}',scopes: ['openid', 'offline_access', 'api://{api-client-id}/access_as_user'],),); - Use the Sign-in logs in the Entra portal to confirm your fix. Enter your Correlation ID (
9c5d72ee-2dfa-4b85-8a8d-7b00b094baaa) and Timestamp (2025-08-21T13:43:59Z) to validate if the failure is resolved or if any scope/audience mismatch remains. See more guides here - https://learn.microsoft.com/en-us/entra/identity/conditional-access/troubleshoot-conditional-access
Though, the error occurs because the requested token’s account type doesn’t align with the API’s supported audience. By using the correct CIAM v2.0 authority, setting the API registration to single-tenant, and correctly requesting your custom scope, the AADSTS500207 issue will be resolved.
Please let us know if you need any further assistance.
Thanks