getting this error intermittently
HttpError 403 when requesting https://www.googleapis.com/discovery/v1/apis/gmail/v1/rest returned "The caller does not have permission"
It works sometimes and other times it doesn't. I see the same issue on the oauth2 playground
this is my code -
googlecredentials = GoogleCredentials(
access_token=None,
client_id='xxx',
client_secret='xxxx',
refresh_token='xxxx',
token_expiry=None,
token_uri="https://www.googleapis.com/oauth2/v3/token",
user_agent='Python client library'
)
service = build('gmail', 'v1', credentials=googlecredentials)
results = service.users().labels().list(userId='me').execute()
labels = results.get('labels', [])
response = service.users().messages().list(userId='me', q='subject:FDA').execute()
print(response)