lundi 4 septembre 2017

Auth0, Laravel 5.4 - after logout user is logged again

I am using Auth0 for authentification, and login is working normally, but as soon as I invoke log out function after redirect user is logged again. This is my route file:

<?php

Route::get('/auth0/callback', '\Auth0\Login\Auth0Controller@callback');

Route::group(['middleware' => ['auth']], function () {
    Route::get('/', 'SiteController@index');

    Route::get('/dashboard', 'DashboardController@index')->middleware('role');
    Route::get('/employees-status', 'ReviewStatusPhasesController@employeesStatus')->middleware('role');
    Route::get('/user-status/{id}', 'UserPhaseController@get')->middleware('role');

    Route::get('/request-update/{id}', 'UserController@requestUpdate');

    Route::post('/search', 'UserController@search')->middleware('role');
    Route::post('/change-status', 'UserPhaseController@changeStatus')->middleware('role');

    Route::get('/logout', function() {
        var_dump(Auth::check());
        Auth::logout();
        var_dump(Auth::check());
        die;
        return redirect('login');
    });
});


Route::get('/login', function () {
    return \App::make('auth0')->login();
})->name('login');

It seems that Auth::logout(); is working as it should, because first var_dump is showing true and second is showing false (rest of the setup is same as in docs http://ift.tt/2gHvooT).

If I try to load the page after logout, I am once again logged in. Any ideas what could be wrong here?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire