Laravel API / Passport - Change auth user

Viewed 122

I use Laravel 5.7 with Passport and Vue component.

I have a Vue component with method to change Auth of user, this method call API by POST.

My API is protected by auth:api middleware.

The connexion to site is with PHP session. I don't want use JWT.

How I can change the account connected ?

public function switchAccount(Request $request, Team $team, User $user)
{
    Auth::guard('web')->login($user);
}
0 Answers
Related