Google-API Python-unauthorized_client: Unerlaubte client oder Umfang in Anfrage

Ich bekomme diese Fehlermeldung beim ausführen meines Codes:

oauth2client.client.AccessTokenRefreshError: unauthorized_client: Unauthorized client or scope in request.

Hier ist mein code:

import json
import requests
import httplib2
from oauth2client.client import SignedJwtAssertionCredentials
from apiclient.discovery import build

if __name__ == '__main__':

    json_key_file = 'my-key.json'

    with open(json_key_file) as json_file:

        json_data = json.load(json_file)
        credential = SignedJwtAssertionCredentials(json_data['client_email'], json_data['client_email'], json_data['private_key'], scope=['https://www.googleapis.com/auth/admin.directory.user','https://www.googleapis.com/auth/admin.directory.user.readonly'], sub='[email protected]')

    http = httplib2.Http()
    http = credential.authorize(http)

    service = build('admin', 'directory_v1', http=http)
    data = service.users().list(domain='domain.com').execute()

    print data

Habe ich den Umfang richtig eingestellt in meiner Konsole, und ich habe meinen Admin-SDK aktiviert in meiner Konsole.
Meine E-Mail ist ein super-admin mit Zugriff auf alle Admin-API-Berechtigungen.

Warum ich diese Fehlermeldung bekommen?

InformationsquelleAutor Andrew | 2014-12-03
Schreibe einen Kommentar