Hi there, I am still new to toddle, but I am happy on how fast I am progressing. I created many pages in my app including the login page. login page successfully redirects to the main page after authentication. I also was able to redirect the other pages to the login page if the user is not authenticated. now i am struggling with redirecting the user back to the page he requested instead of going to the default home page. I tried asking the AI and went through a few discord posts. i was not able to sort it out.
Lucas G
18 days ago
Dec 27, 2024, 5:56 PM
Pass the current URL as a parameter to the login page
👍1
And on successful login, redirect back to that page
this is what i was trying to figure out how to do it , is it ?redirect= or ?redirect_to= or ?redirect_url= while researching i found many answers but non worked
Lucas G
18 days ago
Dec 27, 2024, 7:36 PM
Any would work. You set it as a URL parameter on the login page
When you redirect to the login page you pass it in the URL
Like mydomain.com/login?redirect=mydomain.com/current-page
And on the login page, you check if there’s a url. If so, redirect to it, otherwise go to home page
The parameter can be anything though, that part doesn’t matter.
FouadTarabolsi
18 days ago
Dec 27, 2024, 8:20 PM
thanks, I was able to figure out where the issue is. I was able to successfully implement it by doing configuration this function on the click event in the login page: Default to( Decode URI Component( Get( Get( Parse URL(Current URL()), "searchParams" ), "redirect" ) ), "/home" )
FouadTarabolsi
18 days ago
Dec 27, 2024, 8:21 PM
FouadTarabolsi
18 days ago
Dec 27, 2024, 8:23 PM
@Lucas G now it is clear that redirect, redirect_to or what ever i chose does not matter as long I am consistent int he name on both pages. thank you very much