DEV Community

Discussion on: Making Api CRUD(Create,Read,Update,Delete) with Laravel 8 n API Authentication with sanctum

Collapse
 
tanzimibthesam profile image
Tanzim Ibthesam

Hello Sanchita can you please check whether you have written the logout method in Controller properly.Thanks

Collapse
 
saanchitapaul profile image
Sanchita Paul

I solved this using delete method. It was showing error using logout.

public function logout(Request $request){
//auth()->user()->tokens()->logout();
auth()->user()->currentAccessToken()->delete();
return [
'message'=>'You're logged out'
];
}

Thread Thread
 
tanzimibthesam profile image
Tanzim Ibthesam

Thanks