Oidc-client-js: Signin on pageload

Created on 30 Jan 2017  路  9Comments  路  Source: IdentityModel/oidc-client-js

I麓m not sure about the usage of the userManager functions and how to implement a automatic logon (redirect to OP) on pageload.
In your userManager sample you are taking two (manual) steps:

  1. startSigninMainWindow
  2. endSigninMainWindow

How do i need to combine this calls and get a "cached" user on pageload if the user is already logged in?

thanks for your advice and work!

question

All 9 comments

You could try to call signin silent on page load and if that fails then redirect the main window (or do a popup).

hm this ends up in an infinite loop.

What the flow looks like:

index.html -> signinSilent -> catch -> signinRedirect -> signinRedirectCallback -> index.html

Is your callback page a separate html file -- it should be?

yes and i麓m doing this:

new Oidc.UserManager({loadUserInfo: false}).signinRedirectCallback().then(function (user) { window.location = "index.html"; });

But the silent callback page should be different

would be great if you could provide a working SPA example without the need of manual logging in :/
I think i didn麓t got the flow of the different functions and callbacks from the documentation..

Agree with @thepill as I end up with an infinite loop as well. The documentation is unclear and I already look to @brockallen sample...
I'm trying to setting up an app using Angular 1, automatically checking if the user is logged using getUser() and if user not logged, I call signinRedirect.
The thing is, getUser() always return null after the redirection...

All set on this issue? Can we close?

Was this page helpful?
0 / 5 - 0 ratings