DEV Community

Discussion on: PKCE authenticaton for Nuxt SPA with Laravel as backend

Collapse
 
thorbn profile image
Thor

Hi again Stefan

I'm trying again to figure out how to logout from the backend. How do you logout on the backend?

This dont work: the user is not logget out in the backend


Api route:
Route::middleware(['auth:api'])->group(function () {
Route::post('/logout', 'Auth\AuthWepAppController@logoutApi');
});

AuthWepAppController:
public function logoutApi (Request $request) {

$request->session()->flush();
}


Collapse
 
stefant123 profile image
StefanT123

Just get the users token and delete it.
Auth::user()->token()->delete