I'm using firebase in my web app with Ionic and I would like to redirect the user to a specific page (the login page, in my case) after he change the password successfully. At the moment, when the user clicks on the password reset link, he is redirected on another browser page that says that he has successfully changed the password.
I would like to redirect him to a page of my web app, after changing the password. Is it possible to do that?
You have to pass a continue URL via ActionCodeSettings
to redirect the user back to the app:
var actionCodeSettings = {
// After password reset, the user will be give the ability to go back
// to this page.
url: 'https://www.example.com/afterPasswordReset',
handleCodeInApp: false
};
firebase.auth().sendPasswordResetEmail(email, actionCodeSettings)
.then(function() {
// Password reset email sent.
})
.catch(function(error) {
// Error occurred. Inspect error.code.
});
Learn more about ActionCodeSettings
and passing state in redirect:
https://firebase.google.com/docs/auth/web/passing-state-in-email-actions
You can also build your own custom landing page here: https://firebase.google.com/docs/auth/custom-email-handler
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With