Category : logout

The api I built wqith apssport and laravel 8 does not logout by default. I found a script, but it does not remove the entries in the oauth-access-tokens table I afdded a function to the AuthController: public function logout(Request $request){ $accessToken = auth()->user()->token(); $token= $request->user()->tokens->find($accessToken); $token->revoke(); return response([‘message’=> ‘Je bent uitgelogd’], 200); } And added ..

Read more

I want to call a route of the post method from the Laravel API part i.e. not from the blade file. this is my route Route::post(‘/logout’, [LogoutController::class, ‘destroy’])->name(‘logout’); This is destroy function in LogoutController class public function destroy(Request $request) {} I have tried with the below code. But these are not working. return redirect()->route(‘logout’, [‘request’ ..

Read more

i am hvaing a problem upgrading my laravel from the old version to a new version as you can see in the image below this error is from logout this happen after clicking logout i tried to change the get to post like this image below but still not work i also tried to do ..

Read more

I want to use laravelsanctum with SPA Authentication, where Laravel is backend api and Vue is frontend SPA. I do all manual says about it, but I faced with problem: when my logout route in api.php Route::post(‘/logout’, [AuthController::class, ‘logout’]) is under middleware(‘auth:sanctum’) I couldn’t logout the user because of error: Method IlluminateAuthRequestGuard::logout does not exist. ..

Read more

I face some problem to override function in Laravel. This is the logoutOtherDevices function in the vendor folder (IlluminateAuthSessionGuard) in laravel. public function logoutOtherDevices($password, $attribute = ‘password’) { if (! $this->user()) { return; } $result = tap($this->user()->forceFill([ $attribute => Hash::make($password), ]))->save(); $this->queueRecallerCookie($this->user()); return $result; } But since this is in the vendor folder, so i ..

Read more

I’ll try to be brief. Happy quarantine everybody. I’m using Laravel 6.0.4. I was asked to logout users from all devices whenever they log in from a new location. Supposedly, Laravel makes this very easy with this: https://laracasts.com/series/whats-new-in-laravel-5-6/episodes/7 public function logoutOtherDevices($password, $attribute = ‘password’){ … } I can see that the code changes the password ..

Read more