DEV Community

techdurjoy
techdurjoy

Posted on

How to Logout User from API with Laravel Passport

How to Logout User from API with Laravel Passport. How to Logout User from API with Laravel Passport. How to Logout User from API with Laravel Passport. How to Logout User from API with Laravel Passport. How to Logout User from API with Laravel Passport. How to Logout User from API with Laravel Passport.How to Logout User from API with Laravel Passport.
How to Logout User from API with Laravel Passport. How to Logout User from API with Laravel Passport. How to Logout User from API with Laravel Passport. How to Logout User from API with Laravel Passport. How to Logout User from API with Laravel Passport. How to Logout User from API with Laravel Passport.How to Logout User from API with Laravel Passport.

How to Logout User from API with Laravel Passport

Top comments (1)

Collapse
 
nandeshwar750 profile image
Nandeshwar Katenga
 use Laravel\Passport\RefreshToken;
   public function logout()
   {
       $user = Auth::user();
       $user->token()->revoke();
       RefreshToken::where('access_token_id', $user->token()->id)->delete();

       return response()->json(['message' => 'User logged out successfully']);
   }
Enter fullscreen mode Exit fullscreen mode

Read More here.