diff --git a/src/Appwrite/Auth/OAuth2/X.php b/src/Appwrite/Auth/OAuth2/X.php index e161cf41b4..a2c6f81312 100644 --- a/src/Appwrite/Auth/OAuth2/X.php +++ b/src/Appwrite/Auth/OAuth2/X.php @@ -252,6 +252,10 @@ class X extends OAuth2 $data = OpenSSL::encrypt($verifier, OpenSSL::CIPHER_AES_128_GCM, $key, OPENSSL_RAW_DATA, $iv, $tag); + if ($data === false || $tag === null) { + throw new \RuntimeException('Failed to encrypt PKCE verifier.'); + } + return [ 'data' => $this->base64UrlEncode($data), 'iv' => \bin2hex($iv),