question

shiroy-5335 avatar image
0 Votes"
shiroy-5335 asked JamesTran-MSFT answered

Azure AD CORS issue

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://docs.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



azure-ad-authentication
cors-message.png (129.4 KiB)
deployment-return.jpg (108.8 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

JamesTran-MSFT avatar image
0 Votes"
JamesTran-MSFT answered

@shiroy-5335
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.


image.png (66.4 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.