React: CORS error when invoking auth.logout


#1

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 https://dev-654950.oktapreview.com/api/v1/sessions/me: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localtempus.com:3400' 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:

11%20AM

Thanks!


#2

There is another spot that you need to update, API->Trusted Origin, you will want to add http://localtempus.com:3400 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!


#3

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