4

I am using angular-oauth2-oidc library to connect to ADFS but I get the following error:

enter image description here

I am using the following code:

app.component.ts:

    config.issuer = 'https://myserver/adfs';
    config.clientId = 'https://myapp/';
    config.redirectUri = window.location.origin;
    config.scope = 'openid profile';
    this.oauthService.configure(config);
    this.oauthService.loadDiscoveryDocument();
Lin Du
  • 88,126
  • 95
  • 281
  • 483
Anonimo
  • 41
  • 1

1 Answers1

0

The error is telling you that the browser was instructed by ADFS (through the absence of- or specific settings for its CORS headers) not to allow loading the openid-configuration when your SPA requests it from some other domain (like localhost:4200 or otherwise).

If possible, you should reconfigure ADFS to send CORS headers that allow it being called from specific or possibly even all domains.

If that is not possible, your only option is to not use any loadDiscoveryDocument... features from the library, and instead configure all relevant settings that would be auto-detected yourself, manually.

Jeroen
  • 60,696
  • 40
  • 206
  • 339