Я пытаюсь создать платформу, на которой пользователи дают нам согласие на управление своей учетной записью, но когда я пытаюсь указать учетную запись, я получаю сообщение об ошибке [! [Введите здесь описание изображения] [1]] [1]
, и когда я нажимаю на ссылку, появляется сообщение об ошибке [УДАЛЕНО]
{
"error": {
"code": 403,
"message": "Google My Business API has not been used in project 10318847845122525596215555558 before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/mybusiness.googleapis.com/overview?project=10318847845122525596215555558 then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
"status": "PERMISSION_DENIED",
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"description": "Google developers console API activation",
"url": "https://console.developers.google.com/apis/api/mybusiness.googleapis.com/overview?project=10318847845122525596215555558"
}
]
}
]
}
}
и вот мой проверенный код
<body>
<h2>Infinity</h2>
<div
id="g_id_onload"
data-client_id=""
data-callback="handleCredentialResponse"
></div>
<script>
function handleCredentialResponse(response) {
const config = {
response_type: "permission",
scope: "https://www.googleapis.com/auth/plus.business.manage",
client_id:
"",
};
gapi.auth2.authorize(config, function (response) {
console.log(response);
var requestOptions = {
method: "GET",
redirect: "follow",
};
fetch(
`https://mybusiness.googleapis.com/v4/accounts?access_token=${response.access_token}`,
requestOptions
)
.then((response) => response.text())
.then((result) => console.log(result))
.catch((error) => console.log("error", error));
});
}
</script>
</body>