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

chadhutchins's avatar

Getting logged out after redirect

Hello, I'm having an issue where my user is getting logged out.

I have a user flow where a user (not logged in) goes to endpoint: https://signup.website.com/my/endpoint

This endpoint creates a user and logs them in using Auth::login($user); and then it redirects the user (now logged in) to https://website.com/dashboard

But when they get to https://website.com/dashboard it says they are logged out.

If I do not redirect the user and leave them on https://signup.website.com/my/endpoint if I do something like if (auth()->user()) return "logged in"; it will show they are logged in, but any other subsequent page they go to on https://signup.website.com they will be shown as logged out.

We use .website.com on our session cookies and cross domain/subdomain auth is working just fine for the rest of our services.

Any ideas why this is happening and how I can keep the user logged in?

Thank you!

0 likes
2 replies
Snapey's avatar
Snapey
Best Answer
Level 122

You can check in the browser dev tools, what cookies are present, and if the session cookie is being offered by the client when they navigate to the dashboard

chadhutchins's avatar

@Snapey Thank you! That put me in the right direction. I needed to move those routes to the web routes.

Please or to participate in this conversation.