php - Google REST API ADMIN_ONLY_OPERATION

标签 php rest google-authentication

我尝试使用 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”操作将失败。

Image of the settings in GCP Identity Platform

关于php - Google REST API ADMIN_ONLY_OPERATION,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69160129/

相关文章:

javascript - ajax 响应超过范围的最大值

objective-c - RestKit ios - put - json 而不是编码形式

c# - 使用 GET 访问 WCF 休息服务时出现 400 http 错误请求错误

.net - 如何使用由 ServiceAccountCredential 认证的 SpreadsheetsService?

android - 为什么firebase authUI现在不能使用google账号登录,但之前可以登录

php - 微时间的十进制长度(真)?

xpath 后的 PHP DomXPath 编码问题

php - 表单提交失败后使用 PHP 重新填充所选选项值的最佳方法?

java - 如何在 RESTful webapp 中创建新的 HttpSession?

php - AuthSub 目标路径前缀与提供的 "next"URL 不匹配