I'm trying to share a Laravel 5.1 cookie with another application on a sub-domain (not Laravel) which will allow me to determine if the user is logged into the parent app - and automatically log them into this area.
The code below is where I am having issues - it worked fine with Laravel 4.2 but I recently upgraded to 5.1 and its no longer working. Having spent days going through the internals of Illuminate's Cookie & Session packages I'm no further forward.
public static function getCurrentLaravelSession()
{
$app = sspmod_laravelauth_LaravelContainer::getInstance();
if (!array_key_exists('laravel_session', $_COOKIE)) {
return false;
}
$id = $app['encrypter']->decrypt($_COOKIE['laravel_session']);
$request = Request::capture();
$session = $app['session']->driver();
$session->setId($id);
$session->setRequestOnHandler($request);
$session->start();
dd($session->all());
dd($app['auth']->check());
return false;
}
When the program gets to:
dd($session->all());
the data from the session cookie does not match that which is saved by the parent application. Has anyone ever done something similar or know of a better way to go about determining if a user is logged in?
Any and all help is much appreciated!