
BhaskarR.71547 (Customer) asked a question.
Hi ,I have created React application (SPA in Okta) and Java Spring Boot application (WEB in Okta) in Okta its working fine in React ,when i hit UI url it is navigating okta sing in page and coming back to Home page and for Java API also its working fine ,when i hit API URL in browser its navigating to Okta sign in and coming back to api and its displaying response in browser.
Now the problem is when i call API in react application on button click am getting CORS issue browser not allowing to redirect to Okta from API (UI -API -Okta sign in ). How can I Integrate SPA and WEB .I tried Token validation but if i follow token validation its working through React App but if user hit API URL in browser its throwing unauthorized error because there is no token ..
Please help me how to handle this scenario

This is Florin from Okta support. We have a few articles that may help if you are getting CORS errors on the browser:
https://support.okta.com/help/s/article/CORS-error-when-accessing-Okta-APIs-from-front-end
https://support.okta.com/help/s/article/Access-to-XMLHttpRequest-has-been-blocked-by-CORS-policy?language=en_US
https://support.okta.com/help/s/question/0D51Y00008Mubcl/cors-exception-no-accesscontrolalloworigin-header-is-present-on-the-requested-resource?language=en_US
Also I would suggest opening a case with support or reach our to our developers via email at developers@okta.com or you can post a question on the Okta Developer Forum .
Have a great day ahead!