I am facing problem 419 page expired in Laravel 5.7 multiple authentications. If in case I try to log in user and admin in the same browser but in different tabs. Like in one tab user login screen is open and in the second tab admin login screen is open. First, I try to log in the normal user and user login is successful. But when I go to the second tab and try to log in the admin user, then in this case 419 page expired error is appearing. But if I refresh the second tab mean admin login page before the admin login attempt then admin works fine and logs in successfully without any error (419 page expired). Can you please help me to sort out this issue? I am already sending @csrf
token with the form.
Before you login with any role, two pages have same token value.
(Please check other articles about Laravel CSRF token)
Laravel automatically generates a CSRF “token” for each active user session managed by the application.
So, if you logged in, new user session will be started and CSRF token will be re-generated.
This is why you are getting 419 on admin page before refresh. If you refresh page, Laravel will render new token value.
Please test it on your browser using Inspect function.