/** * Send the response after the user was authenticated. * The response from this is returned instead of the * response from handleUserWasAuthenticated * * @param \Illuminate\Http\Request $request * @param \Illuminate\Contracts\Auth\Authenticatable $user * @return \Illuminate\Http\Response */ public function authenticated(Request $request, Authenticatable $user) { if ($request->wantsJson() || $request->isJson()) { return response(Auth::createToken($user), 200); } return redirect()->intended($this->redirectPath()); }