Reputation: 21
When logging in, authentication works and the user is redirected to the logged-in page (/home at first but I also tried changing to /dashboard) but then the session seems to become lost as it shows an empty array when logging on the logged-in controller.
My setup involves using Redis as a session store but I have tried file and database drives as well with the same results.
Even stranger, I am able to view the session data in my redis cli without any issues.
Some "fixes" I have tried to no avail are:
- removing underscores from session cookie name (as well as dashes/hyphens)
- changing session domain setting to all combinations of main domain and subdomain
Does anyone have any ideas on any other possible fixes?
UPDATE:
Other fixes tried:
php artisan cache:clear
php artisan clear-compiled
Upvotes: 2
Views: 1314
Reputation: 64
The problem resolved with me after remove \App\Http\Middleware\EncryptCookies::class
from web
inside $middlewareGroups
in app\Http\Kernel.php
file.
Upvotes: 0
Reputation: 672
Where did you write your Routes ?
Please note that the web
middleware uses the default Laravel Session.
So routes written in routes/web.php
are the ones using Laravel Session. You can also try using the file driver, but make sure the /storage
folder has at 0755 permission.
also, can you please check you App\Providers\RouteServiceProvider
s mapWebRoutes()
method looks like this?
/**
* Define the "web" routes for the application.
*
* These routes all receive session state, CSRF protection, etc.
*
* @return void
*/
protected function mapWebRoutes()
{
Route::middleware('web')
->namespace($this->namespace)
->group(base_path('routes/web.php'));
}
Assuming you didn't modify the app\Http\Kernel.php
Upvotes: 1