You could use appState to redirect the user:
- Write a
onRedirectCallback
fn for theAuth0Provider
:
const onRedirectCallback = (appState) => {
history.push(
appState && appState.returnTo
? appState.returnTo
: window.location.pathname
);
};
ReactDOM.render(
<Auth0Provider
domain={config.domain}
clientId={config.clientId}
audience={config.audience}
redirectUri={window.location.origin}
onRedirectCallback={onRedirectCallback}
>
<App />
</Auth0Provider>,
document.getElementById("root")
);
- set the
returnTo
value in appState when callingloginWithRedirect
for the “Sign Up” button:
<Button
id="qsLoginBtn"
color="primary"
className="btn-margin"
onClick={() => loginWithRedirect({
screen_hint: 'signup',
appState: {
returnTo: '/signupinfo'
}
})}
>
Sign up
</Button>