Coder Social home page Coder Social logo

Comments (3)

jeroenheijmans avatar jeroenheijmans commented on September 17, 2024 1

Interesting! Thanks for your suggestion. At first glance this seems like a nice improvement! Will try to look at it somewhere during the week, a bit busy at work at the moment.

from sample-angular-oauth2-oidc-with-auth-guards.

jwoyame avatar jwoyame commented on September 17, 2024

I just want to clarify exactly what caused my issue to justify the above added line.

It sometimes works fine, where isAuthenticated is correctly true, and other times doesn't detect that the user is already authenticated.

It turned out that it was incorrectly false only right after I log in.

I traced this to the fact that if the timeoutFactor on the access token is exceeded, then the setupAccessTokenTimer function would trigger an event, and this would cause this line to run in the sample:

this.isAuthenticatedSubject$.next(this.oauthService.hasValidAccessToken());

However, if the token is not old enough for the token timer to fire when the page is loaded, there are no events at all that would trigger this code to run. The fix was to add this line to make sure it always runs initially when the app is loaded.

from sample-angular-oauth2-oidc-with-auth-guards.

jeroenheijmans avatar jeroenheijmans commented on September 17, 2024

Thx for the fix! I've added some tests and merged your PR. ♥🙏

from sample-angular-oauth2-oidc-with-auth-guards.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.