question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

release version 8.0.4 tryLogin() does not work

See original GitHub issue

I’m using release version of 8.0.4 in my angular 8 project with authorization code flow:

here is the code I have

    this.oauthService.configure(authConfig);
    this.oauthService.tokenValidationHandler = new JwksValidationHandler();
    this.oauthService
      .loadDiscoveryDocument()
      .then(() => this.oauthService.tryLogin()) ---> [1]
      .then(() => {
        if (this.oauthService.hasValidAccessToken()) {
          return Promise.resolve();
        }else{
          this.oauthService.initCodeFlow() ---> [2]
        }
      });
  }

Initially when user is not logged in the code at [2] redirects user to login page. Once user provides username/password and click login, the identity provider redirects back to app with “code” in querystring, that is when I’m expecting code at [1] to login the user with code (by redeeming it for tokens).

Instead the tryLogin() method doesn’t work and the user is again redirected to authorzation endpoint in endless loop.

Please help me understand, what is going wrong here.

also, does this example : https://github.com/jeroenheijmans/sample-angular-oauth2-oidc-with-auth-guards/ apply for version 8 ?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6

github_iconTop GitHub Comments

1reaction
jeroenheijmanscommented, Jul 9, 2020

Cool, thx for sharing @jodotlearn! Had not realized that might be affecting things.

I presume we can close the issue then? Let us know if there’s still a problem and we could consider reopening.

1reaction
jodotlearncommented, Jul 9, 2020

I recommend trying to reconfigure the sample you linked to talk to your own IDS. Then see if it does work as expected.

  • if it does work: then your application (angular) code might be the culprit
  • if it does not work: then your IDS might be configured unexpectedly/incorrectly

Thank you @jeroenheijmans

I found my project enabled HashStrategy. Now I disable initial navigation following the Routing with the HashStrategy, and work fine.

Read more comments on GitHub >

github_iconTop Results From Across the Web

angular-oauth2-oidc tryLogin() not working as expected
This function could be used to figure out whether you are already logged-in or not: public isLoggedIn(): Promise<boolean> { return this.
Read more >
angular-oauth2-oidc - Bountysource
Method loadDiscoveryDocumentAndTryLogin() always resolves to true for code flow, which is unexpected, Even the documentation at https://manfredsteyer.github.io/ ...
Read more >
OAuthService - angular-oauth2-oidc
Convenience method that first calls loadDiscoveryDocumentAndTryLogin(...) and if then chains to initLoginFlow() , but only if there is no valid IdToken or no ......
Read more >
Changelog - Nextcloud
We recommend you follow our Release Channels to always have the latest and most secure ... Update timely and don't run unmaintained Nextcloud...
Read more >
Common Problems in Extension Mobility - Cisco Community
Try login to EM. Error:- Login is unavailable(213). Resolution:- This error comes when the device or phone load does not support ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found