简体   繁体   中英

Google API get reviews for my business using java script

I am trying to get google reviews for my business but struggling with implementing it. Can someone share how to get the latest/top 5 reviews using google business API using JavaScript/Postman? I was trying to do so:

GET:

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

but it doesn't work.

Was trying also testing it on Google oauth playground

filling:OAuth flow: Client-side Use your own OAuth credentials: my Client ID here

Step 1:

Authorize API: https://www.googleapis.com/auth/plus.business.manage but here I am getting:

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

The redirect uri in your project on Google cloud console must exactly match the redirect uri you are sending from The easiest solution is to go to your project and add it.

https://developers.google.com/oauthplayground

Which is not the same as as you have an extra slash on the end

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

This video will walk you though it. Google OAuth2: How the fix redirect_uri_mismatch error.

Question from Comments

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

If you check the documentation Method: accounts.locations.reviews.list you will find that it says the following

在此处输入图像描述

API keys only allow you to access public data, the data you are trying to access is private user data and therefore requires authorization in order to access it. You can not use an API key to access this data you must be authorized using one of the above scopes. A video which explains api keys. Everything you need to know about Google API Key's, and where to get one.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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