Skip to content

Commit

Permalink
BUGFIX: Manually send the body as replaceResponse didn’t send it
Browse files Browse the repository at this point in the history
Problem seem Neos core related. Can be changed once figured out and fixed.
  • Loading branch information
daniellienert committed May 18, 2020
1 parent 08e5a0d commit 4eafb3d
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Classes/Controller/OAuthServerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down

0 comments on commit 4eafb3d

Please sign in to comment.