Angular-oauth2-oidc: how to remove the /.well-known/openid-configuration

Created on 22 Jan 2019  路  7Comments  路  Source: manfredsteyer/angular-oauth2-oidc

Hi,

I am trying to use this to add oAuth2 into my angular application but the identity provider that I am tying to connect to does not have a URL with the /.well-known/openid-configuration.

Is there any way of configuring it so that this service does not automatically add this extension onto the issuer URL that I am configuring.

Many thanks

Most helpful comment

I finally got it working using the following config:

  authConfig: AuthConfig = {
    loginUrl: `${discordApiUrl}/oauth2/authorize`,
    redirectUri: `${environment.appUrl}/login-success`,
    clientId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    scope: 'guilds connections identify',
    strictDiscoveryDocumentValidation: false,
    responseType: 'token',
    oidc: false
  };

Followed by

    this.oauthService.configure(authConfig);
    this.oauthService.tokenValidationHandler = new JwksValidationHandler();
    this.oauthService.tryLogin();

All 7 comments

There are two options:

  1. If you have the disco document at a nonstandard URL, you can pass a url to the loadDisco...(...) function, see this source
  2. If you have no disco document at all, you can just omit calling loadDiscoveryDocument...(...) functions, configure all the things that would come from the document yourself on the library's service, and call one of the login methods directly

Take for instance the Discord oauth login process. How would you do that?

Have you tried either of the two methods I suggested? Could you share what you have so far?

I finally got it working using the following config:

  authConfig: AuthConfig = {
    loginUrl: `${discordApiUrl}/oauth2/authorize`,
    redirectUri: `${environment.appUrl}/login-success`,
    clientId: 'xxxxxxxxxxxxxxxxxxxxxxxxxxxx',
    scope: 'guilds connections identify',
    strictDiscoveryDocumentValidation: false,
    responseType: 'token',
    oidc: false
  };

Followed by

    this.oauthService.configure(authConfig);
    this.oauthService.tokenValidationHandler = new JwksValidationHandler();
    this.oauthService.tryLogin();

@westlakem i am having some problem regarding requesting oauth2 api with angular .
always getting error of unauthorized
can you help me in this regard?
thanks

@mrrobot09 I would need much more context, and the last time I dealt with this was months ago... Not sure how much help I would be.

Seems Original Poster solved their issue, so closing this issue seems reasonable.

@mrrobot09 see previous comment, we'd need more context and details. Could you consider opening a new issue (or posting a StackOverflow question), adding enough details to reproduce your problem?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jeroenheijmans picture jeroenheijmans  路  4Comments

medokin picture medokin  路  4Comments

jeroenheijmans picture jeroenheijmans  路  3Comments

PandaaAgency picture PandaaAgency  路  3Comments

uzzafar picture uzzafar  路  4Comments