Google OAuth 2.0 JSON format error

Hi all, so I am experiencing this error which Render keeps returning an error in wrong JSON file format:
google.auth.exceptions.MalformedError: Service account info was not in the expected format, missing fields client_email, token_uri.

I am trying to make my Flask app hosted on Render to access my Google Driver folder. I selected “web application” under application type in the Create OAuth client ID page and after filling in the other information, I get a JSON file with the following format:

{
“web”:{
“client_id”:“xxx”,
“project_id”:“xxx”,
“auth_uri”:“xxx”,
“token_uri”:“xxx”,
“auth_provider_x509_cert_url”:“xxx”,
“client_secret”:“xxx”,
“redirect_uris”:[“https://xxx/oauth2callback”],
“javascript_origins”:[“https://xxx”]
}
}

Here’s my code:
if google_creds_json:
creds = Credentials.from_service_account_info(google_creds_json)
else:
raise ValueError(“Google credentials not found in environment variables”)

drive_service = build(‘drive’, ‘v3’, credentials=creds)

Anyone has any advice on how I should reformat my JSON file?

Hey,

It looks like this issue is related to our application or the information you’re passing to the Google API, not anything on Render’s end. We’re not involved with that part of the process.

Jérémy.
Render Support, UTC+3

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.