has(['email', 'token'])) { throw new UnauthorizedHttpException(null, "Include email and token in your request."); } $user = User::findOrFail($request->get('email')); if ($user->validToken($request->get('token'))) { Auth::login($user); return Auth::user(); } throw new UnauthorizedHttpException(null, "Invalid credentials"); } /** * Get the providers authorization method. * * @return string */ public function getAuthorizationMethod() { return 'token'; } }