php - Sharing Laravel Session Across Subdomains CSRF TOKEN MISMATCH


First of all i already did a lot of research on this topic as i didn't want to waste anyone's time but i didn't found concrete answers.

I need to share a laravel session across SubDomains so that when the user logs out of one SubDomains, he logs out of all SubDomains. I currently have two SubDomains (/login_master and /light), and both the session files are configured to use database driver. This is what they look like:

 'driver' => env('SESSION_DRIVER', 'database'),


Im not sure if the domain is setup correctly (right now it looks like this ".") and they both have the same cookie name. When i try to login i get token mismatch somehow even tough i have included the CSRF_FIELD in the form that makes the request.

Can anyone shed some light into this issue please?

Thank You



---- | Session Lifetime |


---- | | Here you may specify the number of minutes that you wish the session | to be allowed to remain idle before it expires. If you want them | to immediately expire on the browser closing, set that option. | */ 'lifetime' => 30, 'expire_on_close' => false, 'cookie' => 'laravel_session', /* |


---- | Session Cookie Path |


---- | | The session cookie path determines the path for which the cookie will | be regarded as available. Typically, this will be the root path of | your application but you are free to change this when necessary. | */ 'path' => '/', /* |


---- | Session Cookie Domain |


---- | | Here you may change the domain of the cookie used to identify a session | in your application. This will determine which domains the cookie is | available to in your application. A sensible default has been set. | */ 'domain' => env('SESSION_DOMAIN', '.' . $_SERVER['SERVER_NAME'])

People are also looking for solutions to the problem: jquery - Combining two dropdown selection to retrive one result ajax/php


Didn't find the answer?

Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.

Ask a Question

Write quick answer

Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.

Similar questions

Find the answer in similar questions on our website.