简体   繁体   English

如何在出现 PERMISSION DENIED 错误时使用 OAuth2 Playground 获取 Google 帐户数据(项目、地点和所有地点评论)

[英]How to get Google account data (project, place and all place reviews) using OAuth2 Playground while PERMISSION DENIED error

The case:案子:

I want to get all Google My Business API place reviews using OAuth2 for internal project.我想为内部项目使用 OAuth2 获取所有 Google 我的商家 API 地方评论。 I am using OAuth2 Playground for testing purposes while I am not able to get proper permission in these steps:我正在使用 OAuth2 Playground 进行测试,但我无法在这些步骤中获得适当的许可:

  1. Select & authorize APIs: pasting "https://www.googleapis.com/auth/business.manage" in the API field input & clicking "Authorize APIs" Select & 授权 API:在 API 字段输入中粘贴“https://www.googleapis.com/auth/business.manage”并点击“授权 API”
  2. Letting myself obtain authorization code to obtain access token让自己获取授权码来获取访问令牌
  3. Using method GET, without additional headers I am able to obtain basic data about the project, but not from the particular place.使用方法 GET,无需额外的标头,我能够获取有关项目的基本数据,但不能从特定位置获取。 I am able to list accounts.我能够列出帐户。

Even in my project I was able to implement this: https://developers.google.com/my-business/content/implement-oauth .即使在我的项目中,我也能够实现这个: https://developers.google.com/my-business/content/implement-oauth While I was able to use in OAuth2 Playground this: https://developers.google.com/my-business/content/account-data .虽然我能够在 OAuth2 Playground 中使用这个: https://developers.google.com/my-business/content/account-data But I need to use this: https://developers.google.com/my-business/content/review-data .但我需要使用这个: https://developers.google.com/my-business/content/review-data

The error message in response:响应中的错误消息:

      {
  "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"
        }
      }
    ]
  }
}

After I access the project info from the link from response It will show error:"You do not have sufficient permissions to view this page" and this:在我从响应的链接访问项目信息后,它将显示错误:“您没有足够的权限查看此页面”和这个:

You are missing the following required permissions: Project resourcemanager.projects.get serviceusage.services.get您缺少以下必需权限:项目 resourcemanager.projects.get serviceusage.services.get

and links to the IAM docs which I find very confusing.以及我觉得非常混乱的 IAM 文档的链接。

Questions:问题:

  1. What am I missing in order to get review data from place belonging to the account I am accessing to?为了从属于我正在访问的帐户的地方获取评论数据,我缺少什么?
  2. Am I using proper API access or method to reach my desired result?我是否使用正确的 API 访问或方法来达到我想要的结果?
  3. Could the problem be really in some IAM permissions?问题真的可能出在某些 IAM 权限中吗? If so, how to set them to reach my goal?如果是这样,如何设置它们以达到我的目标?

Please check if you have access to the Google My Business API by visiting https://console.cloud.google.com/apis/dashboard请通过访问https://console.cloud.google.com/apis/dashboard 检查您是否有权访问 Google 我的商家 API

Unlike the My Business Account Management API, the Google My Business API required to retrieve reviews is private.与我的企业帐户管理 API 不同,检索评论所需的 Google 我的企业 API 是私有的。


Edit : the overview page is not the issue, I am talking about API access.编辑:概览页面不是问题,我说的是 API 访问。 It should show up in the list of enabled APIs:它应该出现在已启用的 API 列表中:

启用的 API


Edit 2 : You are missing the 9th API, the original Google My Business API. Since the documentation ( https://developers.google.com/my-business/content/prereqs#request-access ) does not mention how to get access to the old API, I would try contacting the API support if they still give out access to it: https://support.google.com/business/contact/api_default编辑 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

in the message you received there is a link in url object在您收到的消息中有一个链接 url object

"links": [ { "url": "https://console.developers.google.com/apis/api/mybusiness.googleapis.com/overview?project=PROJECTCODE", "description": "Google developers console API activation" } "links": [ { "url": "https://console.developers.google.com/apis/api/mybusiness.googleapis.com/overview?project=PROJECTCODE", "description": "谷歌开发者控制台API激活“}

copy that link, open it in the browser, and probably you need to sign into you account and then Enable the APi. Then you should be able to run your code or see what you want in playground复制该链接,在浏览器中打开它,您可能需要登录您的帐户,然后Enable APi。然后您应该能够运行您的代码或在 playground 中查看您想要的内容

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM