has(['user_id', 'token'])) { throw new UnauthorizedHttpException(null, "Include user_id and token in your request."); } $user = User::find($request->get('user_id')); if ($user != null && $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'; } }