0

I have python script to get access token for google-api-for-python through service account known my project is php web app I follow this tutorial [Embed-Api]https://ga-dev-tools.appspot.com/embed-api/server-side-authorization/

And i`ve been put the script in my project with json-key and I make all required changes, here is my python script.

# service-account.py
from oauth2client.service_account import ServiceAccountCredentials

# The scope for the OAuth2 request.
SCOPE = 'https://www.googleapis.com/auth/analytics.readonly'

# The location of the key file with the key data.
KEY_FILEPATH = 'home/mousa/json-key.json'

# Defines a method to get an access token from the ServiceAccount object.
def get_access_token():
  print ServiceAccountCredentials.json-key.json(KEY_FILEPATH, SCOPE).get_access_token().access_token

Now here is the js where i want to invoke get_access_token() method:

gapi.analytics.auth.authorize({
  'serverAuth': {
    'access_token': '{{"invoke get_access_token()!!?"}'
  }
});

How I can invoke method and ensure the output will be access token??

Prifulnath
  • 463
  • 7
  • 24

0 Answers0