enableGrantType($refreshTokenGrant); // App $app = new App([Server::class => $server]); $app->post('/access_token', function (Request $request, Response $response) { /** @var Server $server */ $server = $this->get(Server::class); try { return $server->respondToRequest($request, $response); } catch (OAuthServerException $e) { return $e->generateHttpResponse($response); } catch (\Exception $e) { return $response->withStatus(500)->write( sprintf('

%s

%s

', get_class($e), $e->getMessage()) ); } }); $app->run();