Redirect to page that started auth process | opensaas
In my app, I have page where users can visit but not see all of the data until they are logged in. After they log in/sign up, how can i redirect them back to the page they were trying to see the data
3 Replies
Hi @jit. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:
----------------------
Currently, Wasp supports redirecting users after successful login/signup using the onAuthSucceededRedirectTo field in your app's auth configuration. However, this only allows you to specify a static URL (e.g., always redirect to "/"), not the dynamic "previous page" the user was trying to access before being prompted to log in. This limitation is noted in both the official docs and community discussions [Auth overview: onAuthSucceededRedirectTo].
There is community interest in supporting dynamic redirects (i.e., redirecting back to the page that started the auth process), but as of now, this is not natively supported in Wasp. The feature is mentioned as desirable and has been discussed in GitHub issues and Discord, but the current implementation only supports static redirects [Discord support thread].
Summary:
- You can set a static redirect after login/signup with onAuthSucceededRedirectTo. - Redirecting back to the original page dynamically is not currently supported out-of-the-box. If you need this functionality, you would have to implement a custom solution in your frontend logic (e.g., storing the intended URL in local storage or query params and handling the redirect manually after login), but this approach is not documented in the official Wasp docs. If you need more details or want to follow progress on this feature, you can check the related discussions: - Discord support thread - Auth overview: onAuthSucceededRedirectTo ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @jit, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
- You can set a static redirect after login/signup with onAuthSucceededRedirectTo. - Redirecting back to the original page dynamically is not currently supported out-of-the-box. If you need this functionality, you would have to implement a custom solution in your frontend logic (e.g., storing the intended URL in local storage or query params and handling the redirect manually after login), but this approach is not documented in the official Wasp docs. If you need more details or want to follow progress on this feature, you can check the related discussions: - Discord support thread - Auth overview: onAuthSucceededRedirectTo ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @jit, I seem to be having a bit of trouble. Don't worry though, I've pinged my support and they will try to fix me up! :technologist: Perhaps try again in 15mins?
perfect ty
Wohooo @jit, you just became a Waspeteer level 1!