bearerToken()) { return response()->json([ 'error' => 'invalid_token', 'error_description' => 'The access token provided is expired, revoked, malformed, or invalid.', ], 401, [ 'WWW-Authenticate' => 'Bearer error="invalid_token", error_description="Invalid or expired token"', ]); } throw $e; } } /** * Get the path the user should be redirected to when they are not authenticated. * * @param \Illuminate\Http\Request $request * @return string|null */ protected function redirectTo($request) { if (!$request->expectsJson()) { return route('login'); } } }