Ad

Auth::user() Doesn't Travel Across Subdomains? - Laravel 5.2

I have a subdomain in my site, for example:

http://example.ca
http://blog.example.ca

The blog one is only accessible to people who have the url, that is, its not public or common knowledge. I have a bunch of routes related to this domain that requires you to be logged in.

I have stated in a nav.blade.php that if the user is logged in, there should be a drop down and if not then there should not be a drop down.

this all works for http://blog.example.ca but when I go to http://example.ca I am not authenticated any more.

Is there any way in larval to make me authenticated across all subdomains? Not just the ones who have controller actions that require me to be authenticated?

Ad

Answer

In config/session.php you should change:

'domain' => null,

into

'domain' => '.example.ca',

You should also clear all the cookies

Ad
source: stackoverflow.com
Ad