I'm using Gmail's API to read messages to an inbox. I have a project in the cloud developer portfolio. I sign in with the account whose inbox I have to get data from. I've made a service account without any roles etc and downloaded the required key. I've built a resource using:
scopes = ["https://www.googleapis.com/auth/gmail.readonly"] credentials = service_account.Credentials.from_service_account_files(path, scopes=scopes) service = build( "gmail", "v1", credentials=credentials ) Which is fine. but when I try and pull information from the inbox:
responses = service.users().messages().list(userId="me").execute() which gives me:
googleapiclient.errors.HttpError: <HttpError 400 when requesting <email> returned "Precondition check failed."> I've tried changing "me" to the email, setting some roles. I can access this by using OAuth credentials but not with the service key. What could be causing my issue?