Google API 使用 java 脚本获取对我的业务的评论

Google API get reviews for my business using java script

我正在尝试为我的业务获得 google 评论,但很难实施。有人可以分享如何使用 google 业务 API 使用 JavaScript/Postman 获得 latest/top 5 条评论吗?我正在尝试这样做:

获取:

https://accounts.google.com/o/oauth2/auth?client_id=MY_CLIENT_ID.apps.googleusercontent.com&client_secret=MY_CLIENT_SECRET&scope=https://www.googleapis.com/auth/business.manage&response_type=token&redirect_uri=https://developers.google.com/oauthplayground

但是没用。

也在尝试在 Google oauth playground

上测试它

填充:OAuth 流程:客户端 使用您自己的 OAuth 凭据:我的客户端 ID

第 1 步:

授权API:https://www.googleapis.com/auth/plus.business.manage 但在这里我得到:

Error 400: redirect_uri_mismatch The redirect URI in the request, https://developers.google.com/oauthplayground, does not match the ones authorized for the OAuth client. To update the authorized redirect URIs, visit: https://console.developers.google.com/apis/credentials/oauthclient/938304287177-nkvm5mqk3f5uq9lt9j2srqlgd0bjihip.apps.googleusercontent.com?project=938304287177

您在 Google 云控制台上的项目中的重定向 uri 必须与您发送的重定向 uri 完全匹配最简单的解决方案是转到您的项目并添加它。

https://developers.google.com/oauthplayground

这与你在末尾有一个额外的斜线不同

https://developers.google.com/oauthplayground/

此视频将带您了解它。 Google OAuth2: How the fix redirect_uri_mismatch error.

来自评论的问题

how can I get the reviews using just API key without a need to authorize it using gmail account?

如果你查看文档Method: accounts.locations.reviews.list你会发现它说了以下内容

API 密钥仅允许您访问 public 数据,您尝试访问的数据是私人用户数据,因此需要授权才能访问它。您不能使用 API 密钥访问此数据,您必须使用上述范围之一获得授权。解释 api 键的视频。 Everything you need to know about Google API Key's, and where to get one.