private function extractClientCredentials(ServerRequestInterface $request): array
    {
        // We first try to get the Authorization header, as this is the recommended way according to the spec
        if ($request->hasHeader('Authorization')) {
            // The value is "Basic xxx", we are interested in the last part
            $parts = explode(' ', $request->getHeaderLine('Authorization'));
            $value = base64_decode(end($parts));

            list($id, $secret) = explode(':', $value);
        } else {
            $postParams = $request->getParsedBody();

            $id = $postParams['client_id'] ?? null;
            $secret = $postParams['client_secret'] ?? null;
        }

        return [$id, $secret];
    }