requestApi('POST', 'apps/'.$appId.':exchangeCustomToken', [ 'headers' => [ 'Content-Type' => 'application/json; UTF-8', ], 'body' => Json::encode([ 'customToken' => $customToken, ]), ]); /** @var AppCheckTokenShape $decoded */ $decoded = Json::decode((string) $response->getBody(), true); return $decoded; } /** * @param non-empty-string $method * @param array|null $options * @throws AppCheckException */ private function requestApi(string $method, string|UriInterface $uri, ?array $options = null): ResponseInterface { $options ??= []; try { return $this->client->request($method, $uri, $options); } catch (Throwable $e) { throw $this->errorHandler->convertException($e); } } }