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.

Completing login after signInRedirect

See original GitHub issue

Hi,

We are trying to switch to this library instead of vanilla oidc-client.

In our previous implementation, after calling signInRedirect when the authentication is returned, our redirect_url page contains code that will complete the login by calling userManager.signinRedirectCallback() which completes the authentication by exchanging the authorization code for an access token.

I can’t find an example of how this is done in the library.

I would also like to know if this library handles silentRenewal and how to implement.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
edwardsilholcommented, Mar 22, 2022

Hi, so I figured out why it wasn’t working, posting here in case someone else runs into this :

You must provide an implementation of onSigninCallback to the conf to remove the parameters from the URL upon successful login. Otherwise if you refresh the page and the params are still there the silent login won’t work.

I know an example is provided in your code, but it would be really useful to add it to the readme too, it took me a while to find it.

For anyone reading this and having the same issue :

const onSigninCallback = (): void => { window.history.replaceState({}, document.title, window.location.pathname); };

With this you don’t need the effect I posted above.

Best

1reaction
edwardsilholcommented, Apr 27, 2022

Sorry, it took a while but I just created the PR. Hope it’ll be useful. All the best.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Oidc-client-js trigger login when app start.What is the ...
I am trying to trigger login redirect when application start. First i tried this code; ... after that, everything works good.
Read more >
signInWithRedirect - how to choose where to redirect to?
Hi Friends, I have successfully added login with both IDP and ... option in the config (and add the matching Sign in redirect...
Read more >
Redirect Users
To see an example of how this works, try the React: Login Quickstart. ... often the URL to which users are redirected once...
Read more >
Redirecting back to the client
Redirecting back to the client. The Return URL and the Login Workflow. Once the user has been logged in, they must complete the...
Read more >
Authenticate Using Google with JavaScript - Firebase
Handle the sign-in flow with the Firebase SDK · Create an instance of the Google provider object: · Optional: Specify additional OAuth 2.0...
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