Azure AD CORS issue

shi roy 21 Reputation points
2021-03-25T19:24:42.643+00:00

Hi, we are working on a web project with react.js + spring boot, we use oauth2 and azure-active-directory-spring-boot-starter library to authenticate users, we set it up by following the tutorial: https://learn.microsoft.com/en-us/java/api/overview/azure/spring-boot-starter-active-directory-readme?view=azure-java-stable. It works fine locally, however it gives a CORS error after deploying it on server, if we disable the CORS on browser, it returns a login html file instead of an id token after logging in, i81663-localhost-return.jpgs it caused by azure ad's endpoint? If so is there any way to solve this issue? Thank you so much!81609-cors-message.png81691-deployment-return.jpg

Microsoft Entra ID
Microsoft Entra ID
A Microsoft Entra identity service that provides identity management and access control capabilities. Replaces Azure Active Directory.
19,664 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JamesTran-MSFT 36,456 Reputation points Microsoft Employee
    2021-04-07T21:17:28.91+00:00

    @shi roy
    Thank you for your post and I apologize for the delayed response!

    When it comes to your CORS issue, can you see if our - Solutions for Application Proxy CORS issues helps with this issue? The doc has three potential solutions to the error message that you're seeing.

    85454-image.png

    Additional Links:
    Enable Cross-Origin Requests (CORS) - ASP.NET Core example.
    Enabling CORS on Azure Active Directory

    If you have any other questions or would like to work with our support team on this, please let me know.
    Thank you for your time and patience throughout this issue.

    ----------

    Please remember to "Accept Answer" if any answer/reply helped, so that others in the community facing similar issues can easily find the solution.

    0 comments No comments