Thursday, 6 January 2022

Make Google API Call

To make a Google API call, need to set up the below

  1. need a developer token
  2. client need to create app. For example, if use Google ads api, Google ads account customer needs to create app
  3. get client id and client secret of that app
  4. that app needs to grant permission to use Google specific api. After grant, should get a refresh access token
  5. with developer token, client id, client secret and refresh access code, we can make a Google API call (see the below)

How app to grant permission to use Google api. Use Google ads api as example

Option 1: Use Google oauth play ground

  1. add https://developers.google.com/oauthplayground under Authorized redirect URIs of that App
  2. go to https://developers.google.com/oauthplayground/
  3. click setting and click use your own OAuth credentials. Provide app client id and client secret
  4. select a Google api and click grant permission
  5. Then can convert verification code to access code and refresh access code

Option 2: build a webpag (for web app) to ask user to grant permission

No comments:

Post a Comment