Angular 7 CORS Error

I am currently going through this demo. https://developer.okta.com/blog/2018/12/04/angular-7-oidc-oauth2-pkce

I am doing the OIDC demo.

I am currently getting the following error: Access to XMLHttpRequest at ‘https://dev-979343.oktapreview.com/oauth2/default/.well-known/openid-configuration’ from origin ‘http://localhost:4200’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Any ideas on how to resolve?

Have you configured CORS in your authorization server? Go into API -> Authorization Server -> Trusted Origin tab -> Add Origin. Give it a name and put in http://localhost:4200 as origin URL.

1 Like

Thanks this was the issue. The problem was I did have access to API | Trusted Origin tab.