Hello Apisit,
Thank you for posting question on Microsoft Windows Forum.
Based on the provided error message "AADSTS53003: Access has been blocked by Conditional Access policies." which is probably due to a restriction enforced by Conditional Access (CA) policies in your Azure AD tenant. This occurs when the user or app does not meet the Conditional Access requirements set by your Azure AD/Entra ID administrator.
The following are a few of suggestions worth to be considered.
1.Check the Sign-In Logs.
- In the tenant go to Microsoft Entra / Azure AD → Monitoring & health → Sign-in logs.
- Find the failed sign-in for the user/app and open its Conditional Access tab
- It shows the exact policy name and which condition/grant failed (e.g. device compliance, client app type, location, custom control). This might show you why token issuance was blocked.
2.Contact your Azure AD administrator.
- Providing them with the timestamp and correlation ID of the failed sign-in attempt (these are usually available in the full error response or in the Azure AD Sign-in Logs) in order to review the Conditional Access policies that are being triggered
3.Ensure Application is Registered Correctly.
- Verify your Redirect URI in the Azure AD Application Registration matches the URI where your Next.js frontend is receiving the authorization code, and that it's correctly configured as a Web platform type in the portal. Even if your initial flow uses an app platform, the token exchange usually relies on the registered Web redirect URI.
You can refer to following useful articles for more information regarding the issue.
- https://free.blessedness.top/en-us/entra/identity/conditional-access/troubleshoot-conditional-access
- https://free.blessedness.top/en-us/entra/identity-platform/reference-error-codes
Hope the above information is helpful!