Redirect to original url
infernalred opened this issue · 2 comments
infernalred commented
Hi. I don't understant how i can return user to original url. Example i open /profile, then in navbar press login -> redirect to identity -> authentificate -> redirect to localhost:3000/signin-oidc? + parameters. Why not redirect to original page /profile? How i can fix it. I can redirect to start page localhost:3000 if i add
onSignIn: async (user: any) => { console.log(user); window.location.replace(window.location.origin); },
My settings:
const oidcConfig = {
clientId: process.env.REACT_APP_CLIENT_ID!,
redirectUri: window.location.origin + process.env.REACT_APP_REDIRECT_URI!,
silentRedirectUri:
window.location.origin + process.env.REACT_APP_SILENT_REDIRECT_URI!,
scope: process.env.REACT_APP_SCOPE!,
authority: process.env.REACT_APP_AUTHORITY!,
postLogoutRedirectUri: "https://localhost:3000/",
revokeAccessTokenOnSignout: true,
automaticSilentRenew: true,
autoSignIn: false,
onSignIn: async (user: any) => {
console.log(user);
window.location.replace(window.location.origin);
},
};
<Menu.Item position={"right"} onClick={() => auth.signIn()} name={"Login"} />
Thank you!
infernalred commented
I think I got it, because onBeforeSignon call only if autoSignIn = true. But how to get state or original url, if i want disable autoSignIn