Redirect after login

Is there a way, maybe a rule or some php, to redirect to the previous page after logging in. Right now on our site it just takes you back to the login page but I would like to go back to whatever page they were on before they logged in, or at least to the homepage.

1 Like

Hi there @seacrist, below is a document that talks exactly about the subject you are interested in when it comes to redirecting after login. When you get a minute give it a look and let me know if you have any questions! Thanks in advance!

I wanted to touchbase @seacrist and see if you had any additional questions that I could assist with on this subject? Thanks!

Sorry, I still haven’t been able to get it to work. I also tried to make a rule from here, Redirect Users from Within Rules, and had a rule that had this in it, but it would just redirect to the front-page without logging in.

function (user, context, callback) {
context.redirect = {
url: “https://ipqpubs.org/front-page/
};
return callback(null, user, context);
}

After talking further with our support team, you might have better luck implementing state or nonce in your application. It’s likely not redirecting effectively because it’s not being passed a token.

state optional (String) An arbitrary value that should be maintained across redirects. It is useful to mitigate CSRF attacks and for any contextual information (for example, a return URL) that you might need after the authentication process is finished. For more information, see State Parameter.

https://auth0.com/docs/libraries/auth0js/v9

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.