我尝试使用 PHP cURL for Google REST API 发送短信
$data = array(
'phoneNumber' => '+6512341234'
);
$verify = curl_init();
curl_setopt($verify, CURLOPT_URL, "https://identitytoolkit.googleapis.com/v1/accounts:sendVerificationCode?key=mykeyhere");
curl_setopt($verify, CURLOPT_POST, true);
curl_setopt($verify, CURLOPT_POSTFIELDS, http_build_query($data));
curl_setopt($verify, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($verify, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($verify);
var_dump($response);
但它显示错误:
{
"error": {
"code": 400,
"message": "ADMIN_ONLY_OPERATION",
"errors": [
{
"message": "ADMIN_ONLY_OPERATION",
"domain": "global",
"reason": "invalid"
}
]
}
}
最佳答案
当用户在 Identity Platform/Firebase Auth 中创建帐户的功能被关闭时,会出现此错误。
在 Identity Platform 中,设置 > 用户操作
中有一个名为启用创建(注册)
的复选框。如果未选中此选项,则“sendVerificationCode”操作将失败。
关于php - Google REST API ADMIN_ONLY_OPERATION,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69160129/