customize oauth2 response - RTLer/laravel-oauth2-server GitHub Wiki
if you have structure in your api and want to change oauth2 server response to fallow it you can do it like this:
$response = Oauth2Server::makeAuthorizationServer(['client_credentials'])
->respondToAccessTokenRequest($request, $response);
$oauthResponse = new \RTLer\Oauth2\JsonRespondManipulator($response);
$oauthResponse->editBody(function ($data) {
// $data is an array that contains oauth server response
$data['test'] = 'testing';
return $data;
});
return $oauthResponse->getRespond();