![](/img/trans.png)
[英]How to get Google Fitness API data using OAuth2 with PassportJS
[英]How to get Google account data (project, place and all place reviews) using OAuth2 Playground while PERMISSION DENIED error
案子:
我想為內部項目使用 OAuth2 獲取所有 Google 我的商家 API 地方評論。 我正在使用 OAuth2 Playground 進行測試,但我無法在這些步驟中獲得適當的許可:
即使在我的項目中,我也能夠實現這個: https://developers.google.com/my-business/content/implement-oauth 。 雖然我能夠在 OAuth2 Playground 中使用這個: https://developers.google.com/my-business/content/account-data 。 但我需要使用這個: https://developers.google.com/my-business/content/review-data 。
響應中的錯誤消息:
{
"error": {
"status": "PERMISSION_DENIED",
"message": "Google My Business API has not been used in project PROJECTCODE before or it is disabled. Enable it by visiting https://console.developers.google.com/apis/api/mybusiness.googleapis.com/overview?project=PROJECTCODE then retry. If you enabled this API recently, wait a few minutes for the action to propagate to our systems and retry.",
"code": 403,
"details": [
{
"@type": "type.googleapis.com/google.rpc.Help",
"links": [
{
"url": "https://console.developers.google.com/apis/api/mybusiness.googleapis.com/overview?project=PROJECTCODE",
"description": "Google developers console API activation"
}
]
},
{
"reason": "SERVICE_DISABLED",
"@type": "type.googleapis.com/google.rpc.ErrorInfo",
"domain": "googleapis.com",
"metadata": {
"consumer": "projects/PROJECTCODE",
"service": "mybusiness.googleapis.com"
}
}
]
}
}
在我從響應的鏈接訪問項目信息后,它將顯示錯誤:“您沒有足夠的權限查看此頁面”和這個:
您缺少以下必需權限:項目 resourcemanager.projects.get serviceusage.services.get
以及我覺得非常混亂的 IAM 文檔的鏈接。
問題:
請通過訪問https://console.cloud.google.com/apis/dashboard 檢查您是否有權訪問 Google 我的商家 API
與我的企業帳戶管理 API 不同,檢索評論所需的 Google 我的企業 API 是私有的。
編輯:概覽頁面不是問題,我說的是 API 訪問。 它應該出現在已啟用的 API 列表中:
編輯 2 :您缺少第 9 個 API,原始的 Google 我的商家 API。由於文檔( https://developers.google.com/my-business/content/prereqs#request-access )沒有提及如何獲得訪問權限對於舊的 API,如果他們仍然允許訪問它,我會嘗試聯系 API 支持: https://support.google.com/business/contact/api_default
在您收到的消息中有一個鏈接 url object
"links": [ { "url": "https://console.developers.google.com/apis/api/mybusiness.googleapis.com/overview?project=PROJECTCODE", "description": "谷歌開發者控制台API激活“}
復制該鏈接,在瀏覽器中打開它,您可能需要登錄您的帳戶,然后Enable
APi。然后您應該能夠運行您的代碼或在 playground 中查看您想要的內容
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.