Google API using service account returning key error

Viewed 92

I'm not sure what I am doing wrong here, the code here is basically taken from the docs. When running this code however I get a key error: access_token:

from googleapiclient.discovery import build
from oauth2client.service_account import ServiceAccountCredentials

SCOPES = ['https://www.googleapis.com/auth/admin.directory.user'
          'https://www.googleapis.com/auth/admin.directory.group.member',
          'https://www.googleapis.com/auth/admin.directory.group.member.readonly',
          'https://www.googleapis.com/auth/admin.directory.group.readonly']
credentials = ServiceAccountCredentials.from_json_keyfile_name(
      'keyfilecredentials.json',
      scopes=SCOPES)
service = build('admin', 'directory_v1', credentials=credentials)
list = service.users().list().execute()
0 Answers
Related