Failed to load openid-configuration. No 'Access-Control-Allow-Origin' header is present
See original GitHub issueHi,
my Identity Provider does not allow to load a discovery document.
I am going to use your samples regarding configuration without discovery:
export class AppComponent {
constructor(private router: Router, private oauthService: OAuthService) {
this.configureWithoutDiscovery();
}
private configureWithoutDiscovery() {
this.oauthService.configure(noDiscoveryAuthConfig);
this.oauthService.tokenValidationHandler = new NullValidationHandler();
this.oauthService.tryLogin();
}
But when i execute the code above absolutely nothing happens in the console. No consent screen, no error. nothing.
When i use this.oauthService.loadDiscoveryDocumentAndLogin();
it works nice on localhost but when deploying to production i am told the error with No ‘Access-Control-Allow-Origin’ …
My noDiscoveryAuthConfig
document is fully configured. (skipping the JWKS section)
export const noDiscoveryAuthConfig: AuthConfig = {
clientId: 'aistoxt_ig_client',
redirectUri: environment.pingIdentity.callbackURL,
postLogoutRedirectUri: '',
loginUrl: environment.pingIdentity.loginURL,
scope: 'openid profile email',
resource: '',
rngUrl: '',
oidc: true,
requestAccessToken: true,
options: null,
issuer: environment.pingIdentity.issuer,
clearHashAfterLogin: true,
tokenEndpoint: environment.pingIdentity.tokenEndpointURL,
userinfoEndpoint: environment.pingIdentity.userinfoEndpointURL,
responseType: 'token',
showDebugInformation: true,
silentRefreshRedirectUri: environment.pingIdentity.silentRefreshRedirectUri,
silentRefreshMessagePrefix: '',
silentRefreshShowIFrame: false,
silentRefreshTimeout: 20000,
dummyClientSecret: null,
requireHttps: 'remoteOnly',
strictDiscoveryDocumentValidation: false,
customQueryParams: {
pfidpadapterid: 'OAuthAdapterCCDS',
},
silentRefreshIFrameName: 'angular-oauth-oidc-silent-refresh-iframe',
timeoutFactor: 0.75,
sessionCheckIntervall: 3000,
sessionCheckIFrameName: 'angular-oauth-oidc-check-session-iframe',
disableAtHashCheck: false,
skipSubjectCheck: false,
};
Any clue?
Issue Analytics
- State:
- Created 5 years ago
- Comments:14 (8 by maintainers)
Top Results From Across the Web
IdentityServer 4 2.0 userInfo "No 'Access-Control-Allow-Origin ...
Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested ...
Read more >No 'Access-Control-Allow-Origin' header is present on the ...
I have configured all the file jetty-runtime.xml , jetty-admin.xml, response-header-runtime-config.xml and cors-configuration.xml and also added all urls in ...
Read more >OpenID Discovery document does not have CORS headers
Summary https://gitlab.com/.well-known/openid-configuration does not have any CORS headers set prevents browser based user-agents (ie.
Read more >Fixing "No 'Access-Control-Allow-Origin' Header Present"
"No 'access-control-allow-origin' header present" is one of the least helpful error messages. So, what is it and why is it breaking your web ......
Read more >Response to preflight request doesn't pass access control ...
... i keep on getting the following error:- Failed to load htt… ... control check: No 'Access-Control-Allow-Origin' header is present on the ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@jeroenheijmans thanks for pointing out the need CORS. for sure this will help me giving it another try in my “people problem” 😃 (you nailed it)
BTW: updated my last comment… Never wanted to be mad at you guys. Love the work you do. Really appreciate it!
@jeroenheijmans the arguments you mentioned seems to have been enough! 😃
Found out that our IT guys have CORS setting for https://*.mycompany.com. If my SPA would be hosted there it would have worked. BUT: My website is hosted under https://*.mycompany.azurewebsites.net. We did not have a CORS setting for this. The CORS rule will be applied - simple in the end
This means we can close this issue. The library will do it’s job.
Solution: CORS rule has to be set in IdServer
i learned a lot on this one: i have focused on the workaround instead of the root cause. @jeroenheijmans you are the man! thanks for pointing out the right direction.
cc: @MarcDrexler