diff --git a/src/Middleware/ResourceServerMiddleware.php b/src/Middleware/ResourceServerMiddleware.php index 70711b94..fda7861d 100644 --- a/src/Middleware/ResourceServerMiddleware.php +++ b/src/Middleware/ResourceServerMiddleware.php @@ -43,7 +43,7 @@ class ResourceServerMiddleware $request = $this->server->getResponseType()->determineAccessTokenInHeader($request); if ($request->getAttribute('oauth_access_token') === null) { - $exception = OAuthServerException::accessDenied('Access token was invalid'); + $exception = OAuthServerException::accessDenied($request->getAttribute('oauth_access_token_error')); return $exception->generateHttpResponse($response); }