0
我已經gmail的API激活獲得403「權限不足」來自Gmail的API和我與「完整的API訪問所有谷歌雲服務」的實例。當我運行從實例如下:使用get_application_default從GCE實例
credentials = GoogleCredentials.get_application_default()
service = build('gmail', 'v1', credentials=credentials)
service.users().messages().list(userId='me').execute()
我得到:
HttpError: <HttpError 403 when requesting https://www.googleapis.com/gmail/v1/users/me/messages/send?alt=json returned "Insufficient Permission">
我嘗試了好幾種其他Gmail-API調用,這始終是響應。
努力通過文檔:從'進口oauth2client.gce AppAssertionCredentials 範圍=的 'https://www.googleapis.com/auth/gmail.compose' 憑證= AppAssertionCredentials(範圍) http_auth = credentials.authorize(HTTP ()) 服務=建立(的Gmail「, 'V1',HTTP = http_auth) service.users()。消息()。表(用戶ID = '我')。執行()' 得到了相同的結果403 –