diff --git a/Classes/Controller/OAuthServerController.php b/Classes/Controller/OAuthServerController.php index 5babca6..c0107b9 100755 --- a/Classes/Controller/OAuthServerController.php +++ b/Classes/Controller/OAuthServerController.php @@ -145,7 +145,20 @@ public function accessTokenAction(): string return $this->authorizationServer->respondToAccessTokenRequest($this->request->getHttpRequest(), new Response()); }); - return PsrRequestResponseService::replaceResponse($response, $this->response); + $this->response->setContentType('application/json; charset=UTF-8'); + + $response->getBody()->rewind(); + $bodyContent = $response->getBody()->getContents(); + + if ($response->getStatusCode() === 200) { + $this->logger->info(sprintf('OAuth token successfully generated for client "%s"', $this->getRequestingClientFromCurrentRequest()), LogEnvironment::fromMethodName(__METHOD__)); + $data = json_decode($bodyContent, true); + if (is_array($data)) { + $this->logger->debug('OAuth token data', $data + LogEnvironment::fromMethodName(__METHOD__)); + } + } + + return $bodyContent; } /**