How do I use the same session in laravel for all subdomains?

0

I'm trying to login to a subdomain users.mydomain.com. To test the session, I'm just displaying what I type in the login field on the screen with the code in the controller:

if($request->session()->has('session_login'))
   return view("welcome", ["session_login" => $request->session()->get('session_login')]);

After that a simple {{$ session_login}} correctly displays what I typed. However I also want to use this same session in the clinic.domain.com subdomain, but it is not working. I put the following code in the controller of this second subdomain:

if($request->session()->has('session_login'))
    View::share('session_login', $request->session()->get('session_login'));
else
    View::share('session_login', "BBB");   

But always only displays "BBB" in the second subdomain. I already configured the sessions.php file in both applications, putting 'domain' => ".i9technology.com.br" , and I'm also using Homestead. What's missing for this session to work in both subdomains?

    
asked by anonymous 04.10.2016 / 15:16

1 answer

0
  • Capture ID session Session::getId() in Domain A
  • Send ID caught via HTTP POST to Domain B
  • Receive this value in Domain B $sessionid_from_domainA = \Input::get('ID');
  • Set in Session ID in Domain B Session::setId($sessionid_from_domainA)
  • Finally, Session::start() in Domain B
04.10.2016 / 15:23