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??

2

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.