enableGrantType($passwordGrant); // App $app = new App([Server::class => $server]); $app->any('/authorise', function (Request $request, Response $response) { if (strtoupper($request->getMethod()) === 'GET') { $response = $response->withHeader('Set-Cookie', $authCodeGrant->storeOriginalRequestParams) } }); $app->post('/access_token', function (Request $request, Response $response) { /** @var Server $server */ $server = $this->get(Server::class); try { return $server->respondToRequest($request); } catch (OAuthServerException $e) { return $e->generateHttpResponse(); } catch (\Exception $e) { return $response->withStatus(500)->write($e->getMessage()); } }); $app->run();