googleworkspace / python-samples

🐍 Python samples for Google Workspace APIs
Apache License 2.0
1.21k stars 899 forks source link

ValueError: Client secrets must be for a web or installed app. #136

Open sruriel opened 4 years ago

sruriel commented 4 years ago

Expected Behavior

List the google drive content

Actual Behavior

raceback (most recent call last): File "list_drive.py", line 48, in main() File "list_drive.py", line 28, in main 'credentials.json', SCOPES) File "/home/rommel_uriel/.local/lib/python3.7/site-packages/google_auth_oauthlib/flow.py", line 199, in from_client_secrets_file return cls.from_client_config(client_config, scopes=scopes, **kwargs) File "/home/rommel_uriel/.local/lib/python3.7/site-packages/google_auth_oauthlib/flow.py", line 159, in from_client_config 'Client secrets must be for a web or installed app.') ValueError: Client secrets must be for a web or installed app.

Steps to Reproduce the Problem

1.Run the code in python 3.7 1. 1.

Specifications

jmagana2000 commented 4 years ago

Check if you have a client_secret.json file and make sure that name is in

flow = InstalledAppFlow.from_client_secrets_file( 'client_secret.json', SCOPES)

codelinn commented 4 years ago

I have same problem. I try to change file name to client_secret.json , but it not work.

rjpruitt16 commented 4 years ago

changing name to client_secret did not work for me either

wescpy commented 4 years ago

Try renaming it to credentials.json because that's what the code is looking for (yes, some of our other samples use client_secret.json too). When you originally downloaded it from the devconsole, it'll try to save w/a really long name like client_secret_GIANT_HASH.json, so best to just save it directly as the shortened name from there, ensuring it matches the filename expected in the code.