When using more than one environments for my single page application I am getting a CORS error. First I log in to the application running on localhost. When I switch to the production environment I am getting a CORS error. When I log in to the production environment first, I get the CORS error when I switch to the application running on localhost.
This is the error message:
Access to XMLHttpRequest at ‘https://mydomain.oktapreview.com/oauth2/default/v1/keys’ from origin ‘https://my.production-environment.com’ has been blocked by CORS policy: The ‘Access-Control-Allow-Origin’ header has a value ‘http://localhost:8080’ that is not equal to the supplied origin.
I am using this library for handling OIDC:
My application should be configured correctly because everything was working the last time I checked.