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

Redirect to original URL after signin (deep linking) #887

Closed
elliotgonzalez-lk opened this issue Aug 19, 2022 · 5 comments
Closed

Redirect to original URL after signin (deep linking) #887

elliotgonzalez-lk opened this issue Aug 19, 2022 · 5 comments

Comments

@elliotgonzalez-lk
Copy link

Hello! I am migrating from a now deprecated oidc client library to this one, and everything has gone smoothly. However, I cannot figure out how to redirect the user to the original URL after signin. I apologize if I am missing something terribly obvious, but I cannot figure this out.

Logged out user pastes http://localhost:3000/blog/1 into the browser URL bar -> They are redirected to the IDP signin page -> Enter username and password -> authenticated -> redirected to the / route instead of http://localhost:3000/blog/1

  • I see the state param key appended to the URL during the callback.
  • The state key on userData is always undefined. Any attempt to update this value does not work due to it being readonly.
  • Trying to run window.history.replaceState() in the onSignin callback does nothing.

Does the library do anything with that state param? Is there any way to implement deep linking? Would you be able to point me to any examples of this working? I would greatly appreciate it. Thanks.

@horizondave
Copy link

Never used it myself, but I was looking to see if support for this functionality was provided too.
I think it's a case of DIY using the onBeforeSignin and onSignin hooks.
https://github.com/bjerkio/oidc-react/blob/main/docs/interfaces/authcontextinterface.authproviderprops.md#onbeforesignin

@laurakutovaja
Copy link
Contributor

@elliotgonzalez-lk any luck with this issue?

@forforfos
Copy link

Seems that @laurakutovaja fixed this! Maybe this issue should be closed?

@braaar
Copy link
Member

braaar commented Oct 20, 2022

fixed by #910

@braaar braaar closed this as completed Oct 20, 2022
@AlexanderKositsyn
Copy link

AlexanderKositsyn commented Oct 21, 2022

When will #910 be released? I need this fix

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

6 participants