Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Init implicit flow on page load #36

Open
svrooij opened this issue Apr 27, 2017 · 3 comments
Open

Init implicit flow on page load #36

svrooij opened this issue Apr 27, 2017 · 3 comments

Comments

@svrooij
Copy link

svrooij commented Apr 27, 2017

I'm trying to implement some sort of single-sign-on when the user loads the app but doesn't have a valid (access-/)identitytoken. How who we implement this?

  1. User enters page
  2. Not logged in?
  3. Redirect to token provider
  4. Check the token
  5. Access the application

We want to implement it so the user doesn't have to press the login button, they are probably already logged-in so they'll get a token instantly.

Where should I put the initImplicitFlow() call for this to happen?

@stumpyfr
Copy link

stumpyfr commented Jun 1, 2017

Working solution for me, in your app component when you initialize the service:

    this.oauthService.loadDiscoveryDocument().then(() => {
      this.oauthService.tryLogin({});
      if (this.oauthService.getIdToken() == null) {
        this.oauthService.initImplicitFlow();
      }
    });
    this.oauthService.tryLogin({});

@svrooij
Copy link
Author

svrooij commented Jun 1, 2017

That works perfectly, but it looks wrong.

@stumpyfr
Copy link

stumpyfr commented Jun 1, 2017

I agree at 100%, as always with oAuth/openID, a lot of magic :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants