React: CORS error when invoking auth.logout


When I invoke auth.logout() in my React app while logged in, I appear to be logged out correctly (refreshing the app shows that I need to re-authenticate) but instead of forwarding me to the Okta login page after logging out, I receive a CORS error visible on my console:

Failed to load Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin '' is therefore not allowed access.

Is there some configuration that I missed in the application settings in the Okta console? Here’s what I think is the relevant config:




There is another spot that you need to update, API->Trusted Origin, you will want to add as a trusted CORS origin. The reason for this is where Okta is allowed to redirect to is different than where there is code that needs to make a call to our API.

Let me know if this fixes the issue for you!


Yeah, that was it - thank you! Still learning the basics here. :slight_smile: