W
Wasp-langSanchez

Direct to a defined page after successful login

Hello I have the standard LoginPage, as given in the ToDo App tutorial (see picture). I now would like to implement that the user get's to the /board Page, when successfully logged in. Can anybody tell me how I can do that or where I could find a good solution? Thanks a lot! (MacOS, wasp version = 0.13.2
No description
kapa.ai
kapa.ai16d ago
Hi @Sanchez. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- Sure, you can achieve this by using the onAuthSucceededRedirectTo field in your Wasp code. This field allows you to specify the route to which Wasp will send a user after a successful login/signup. By default, it is set to "/", but you can change it to "/board" to meet your requirements. Here is how you can do it:
auth {
onAuthSucceededRedirectTo: "/board"
}
auth {
onAuthSucceededRedirectTo: "/board"
}
Please note that automatic redirect on successful login only works when using the Wasp-provided Auth UI. You can read more about it here (https://wasp-lang.dev/docs/auth/overview#onauthsucceededredirectto-string). Also, keep in mind that this feature was a result of a feature request (https://github.com/wasp-lang/wasp/issues/327) and might not be available in older versions of Wasp. Make sure you are using a version that supports this feature. ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ---------------------- Sorry @Sanchez, 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?
Filip
Filip15d ago
Hi @Sanchez, the bot is right! Here are the docs for this feature: https://wasp-lang.dev/docs/auth/overview#onauthfailedredirectto-string-