Redirect to original URL after signin (deep linking)
elliotgonzalez-lk opened this issue · 5 comments
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 onuserData
is always undefined. Any attempt to update this value does not work due to it being readonly. - Trying to run
window.history.replaceState()
in theonSignin
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.
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
@elliotgonzalez-lk any luck with this issue?
Seems that @laurakutovaja fixed this! Maybe this issue should be closed?
When will #910 be released? I need this fix