Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

joshuaf's avatar

Redirect after login

I simply want to redirect a user to my preferred page after they login. I deploy to heroku and composer installs everything when a push is made so altering the Spark code itself is not going to work and it is generally not a good thing to alter vendor code.

Here are some things I have tried.

Altering the redirectTo and redirectPath variables in the auth controller and the password controller in my app.

Adding a login controller to my app - independent of spark - and then resetting the same variables.

Attempting to call the afterLoginRedirectTo and afterAuthRedirectTo functions in the Spark service provider. This returned an error indicating that the functions did not exist. There is no documentation for these functions that I have found and I am not sure where the person who told me this got that function name from.

Adding in a redirectTo function

This is obviously very frustrating. I am not sure why this isn't something that is dealt with in the documentation and handled as an option as this is something that most users would want to do.

Anything is helpful.

0 likes
2 replies
forrestt's avatar

I am struggling with this as well, I'll let you know if I figure it out.

joshuaf's avatar

What I ended up doing was altering the home page to be what I wanted. My page is an angular app, so I added a button for the user to "Launch" the app. Not my favorite, but works OK.

Please or to participate in this conversation.