mardi 23 août 2016

Laravel Session: sessions for subdomain is not setting on the browser

is it possible to setup two different laravel project on a same domain and same server but different Authentication??.. one is on maindomain.com and one is 'sub.maindomain.com'.

Iv'e been trying to setup the config/session, config/auth, config/database into different drivers/configurations but i still get TokenMismatchException so many times, seems like the session is not persisting or something,

here's my configurations

'lifetime' => 120,
'expire_on_close' => false,
'driver' => env('SESSION_DRIVER', 'file'), // i also tried setting it to database, redis, file, cookie,
'domain' => env('SESSION_DOMAIN', null), // i tried setting it to null,  '.maindomain.com', 'sub.maindomain.com',
'cookie' => 'maindomain_session', // for my subdomain, i set it to 'sub.maindomain.com'

iv'e tried different settings for my two project, but i keep on getting TokenMismatchException for my subdomain. i don't know if i set it up correctly tho..

Iv'e checked the browser if any session is set in there, and i found out that there is none,

and this test was to check if there's any session storing on the browser,

Route::group(['prefix' => 'test'], function() {

  Route::get('session', function() {
    Session::put('testing', 'Hello World');
    return redirect('test/session-result');
  });

  Route::get('session-result', function() {
    return 'this should output the session: '.Session::get('testing');
  });
  // server responded with 'this should output the session: ' text.
});



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire