About 579,000 results
Bokep
- Viewed 7k times1edited Nov 24, 2020 at 16:52
It should be POST Request instead of GET request, because your deleting/making change to the database.
The route should look like this:
Route::POST('logout', 'App\Http\Controllers\UserController@logout')->middleware('auth:api');And the logout method in in UserController should be.
public function logout(){auth()->user()->tokens->each(function ($token, $key) {$token->delete();});return response()->json(['message' => 'Logged out successfully!','status_code' => 200], 200);}Content Under CC-BY-SA license How can I delete the token when the user log out?
Auth::user()->tokens->each(function($token, $key) {. $token->delete(); }); return response()->json([. 'message' => 'Logged out successfully!', 'status_code' => 200. ], 200); When I test it with postman with the GET route: http://127.0.0.1:8000/api/logout.Explore further
php - Remove a laravel passport user token - Stack Overflow
- People also ask
Laravel REST API with sanctum Authentication | Delete current …
Sanctum logout problem - Laracasts
Laravel - The PHP Framework For Web Artisans
Method: tokens.delete | Admin console | Google for Developers
Revoke ID tokens | Authentication | Google for Developers
Delete refresh tokens for a user - Auth0
Deleting User Account & Revoke Access Token - Medium
Laravel Sanctum | laravel
Deleting User Account & Revoke Access Token - Medium
Using the Django authentication system | Django documentation
How to authenticate api using laravel sanctum - Medium
Delete my user | ZITADEL Docs
Manage Refresh Tokens with Auth0 Management API
How can I logout and revoke all oauth tokens in laravel 8 api?
Laravel Passport: How to revoke and delete refresh token?
Auth0 Management API v2
Multi-Factor Authentication Token Revoked - Event Reference
After setting an api token for a user why is $user->tokens () empty?
Understanding OAuth scopes for bots | Slack
How to delete FirebaseAuth currentUser created with custom token
Supabase API reference - Update auth service config
How to remove a user from a shared Windows device
drf django rest auth how to expire or delete token?
- Some results have been removed