W
Wasp-lang•9mo ago
Gwaggli

onAuthSucceededRedirectTo previous site

When I open a Link in my app where Auth is required but my session expired, I get redirected to the login site which is perfect. But i would love to make it possible to store the previous url so I get redirected to the previous page after successful login. Is something like this already possible and i just missed it or is it planned for the future? (or not at all?) I found this section in the docs, but it seems like it only supports static urls: https://wasp-lang.dev/docs/auth/overview#onauthsucceededredirectto-string
Overview | Wasp
Auth is an essential piece of any serious application. That's why Wasp provides authentication and authorization support out of the box.
3 Replies
miho
miho•9mo ago
I believe this workaround might work you as well: https://ptb.discord.com/channels/686873244791210014/1207292303476002846/1207672723518525524 TLDR: use localStorage to keep some info + manually redirect to /login by checking the user you get from useAuth We did make an issue on GitHub to help make "seamless" login redirects better.
Gwaggli
GwaggliOP•9mo ago
Thanks for the super quick response. I would have to get rid of all authRequired flags and do it myself unfortunately which would be too inconvenient so I guess I need to wait for the issue to be resolved 🙂
martinsos
martinsos•9mo ago
Yup, we certianly want to implement this, as I think it is a very reasonable use case and probably the best default for most apps! So we will be doing it, not yet sure when exactly though, but it is coming at some point. I added link to this discord convo to the gh issue, it helps prioritize it since it shows there is demand
Want results from more Discord servers?
Add your server