Append 'returnUrl' to generated token/uid URL which is sent to user's email
@florianheinemann , Hi guy, I want to append a 'returnUrl' into generated token/uid URL which is sent to user's email, so that client route can switch back to last visited url which was visited before 'SignIn' and requestToken. any idea? Thanks.
Does this answer your question? https://passwordless.net/deepdive#successful-login-and-redirect-to-origin
I don't think so. the successRedirect of acceptToken is a 'fixed' path, but my case need redirect to a 'dynamic' path. My use case like this:
- User visit a specific 'Last visited URL'
- If user is not authenticated, the client will redirect to 'Login' page(I understand this step can be done by Restricted middleware) 3 then user input email and post 'sendToken' to server, passwordless will requestToken, user will receive a mail
- User open URL with token/uid in email, passwordless will acceptToken, if anthorized successfully, I hope redirect to 'Last visited URL' in step 1.
The question is how acceptToken middleware to get this 'Last visited UrL' as its options.successDirection in step4?
Hey,
That's exactly what enableOriginRedirect is supposed to do. It overwrites successRedirect with the last visited URL
Cheers