I have created a small API via OAuth2. However, I have noticed that all calls to my API are really slow. To slow. When need to just create token, it takes 3-5 seconds. I have tested API on my local on development server with same results. Also, it not matter if I'm making calls from PHP CURL or any REST API tools/plugin. It always works same slow.
Some parts of my API:
$this->storage = new OAuth2\Storage\Pdo(connect(), []);
$this->server = new OAuth2\Server($this->storage);
$this->server->addGrantType(new OAuth2\GrantType\UserCredentials($this->storage));
$this->response = $this->server->handleTokenRequest(OAuth2\Request::createFromGlobals());