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

asamamun's avatar

When others login to my site, everyone is getting last logged in users auth

Hello Everyone. The problem I am facing is getting serious in Linux server, in the local server, it is working fine. When I logged into my laravel app, sometimes I am logged in as other users, I mean I am not getting my auth id in Linux shared hosting server sometimes. Again, when others are logged into the site and when I refresh my page I am getting their token/authentication info. I have no idea about the problem. What may go wrong? I am using the default authentication system with default auth middleware. Can someone help me, please? Video Link: https://youtu.be/vaLZKroJd-s Site: http://idbbisew.com/sn/

0 likes
10 replies
lostdreamer_nl's avatar

I've tried registering on your website (test & test2) I did a friend request and accepted the friend request.

Then i started login in on both accounts via 2 different browsers.

It never switched between accounts, even after 100+ refreshes.

Are you sure these are the only steps needed?

asamamun's avatar

yes, these are the only steps. Can you please watch the video link I added. I don't know how to repeat the error again. But the problem is happening. In my office when everyone is logging in, some of us are getting last users login auth info. this is frustrating. :(

DirkZz's avatar

I can reproduce this error like so;

Login on FireFox (Test1): f1984095@nwytg.net testtest

Login on Chrome (Test2): wkl11047@awsoo.com testtest

Then I refresh FireFox a couple of times, followed by a couple of refreshes in Chrome and then FireFox again.

After a few seconds on Firefox I am also logged in as Test2.

This isn't default laravel behaviour and without code I can't really tell what is wrong.. But I would really re-check the login stuff..

Both the code as the session files that get written depeding on which session driver you use.

But also check for stupid gotcha's like someone using methods like Auth::logingUsingId($SomeWeirdValueThatIsLastLoggedInUser);

My answer is quite vague, but so is your problem description.

1 like
asamamun's avatar

the thing is, half an hour ago, i logged in as admin and session showed i am user test. I understand that someone was logged in and i got his auth. But that is very strange. I am doomed.

Cronix's avatar

Are you using the default auth with no customizations? If you're not, you'll need to show your code for logging in and how you're handling auth in general. Without seeing the code, no one will be able to really help beyond confirming that it's happening on your site.

asamamun's avatar

I'm using default auth with no customization. My session driver is file. I really cannot figure it out from where i should find the bug. I am also not sure if I've done any silly mistake. I can provide my cpanel's auth or any other option you like.

DirkZz's avatar

@asamamun The only way I can reproduce your situation in a project of my own is when I copy the contents of another session file ( located in /store/framework/sessions/ ) to my own active session file.

Maybe you can look in that direction?

1 like
asamamun's avatar

@DirkZz , thank you very much for the direction. i will try cookies and database driver tomorrow.

Mick79's avatar

This isn't very helpful but you stated you're using the laravel built in auth with no customisations. Are you ABSOLUTELY certain about this? If that's true then this just shouldn't be happening?

Are you doing anything with sessions or the user model in terms of trying to track or count live logins or anything like that?

asamamun's avatar

@Mick79 , i am absolutely sure that I am using default scaffolded Auth with no customizations. This is my first project with version 5.7.2.

Please or to participate in this conversation.