quickstart.py: Client secrets must be for a web or installed app.

未關閉
#158 2 則留言 3 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

評估

難度
3/5
預估耗時
半天
新手友好度
35/100
Issue 類型
缺陷
描述清晰度
基本清楚
活躍度
停滯
技術堆疊
python

研究方向

The traceback points to the from_client_secrets_file call near line 31 of the quickstart script (named google_docs.py in the report), which loads credentials.json through google_auth_oauthlib's InstalledAppFlow. Start there and check whether the sample expects an OAuth client file, since a service account key is rejected. Done means either the sample accepts a service account key or the README clearly says which credential type to download. The thread has been silent for about three years, so confirm with a maintainer before starting.

由索引模型根據 Issue 內容生成。

描述

Steps to Reproduce the Problem

  1. Create Service account and download JSON file with credentials
  2. Run quickstart.py

Expected Behavior

The script works just fine, everything works from the box.

Actual Behavior

The traceback:

    Traceback (most recent call last):
  File "google_docs.py", line 46, in <module>
    main()
  File "google_docs.py", line 31, in main
    'credentials.json', SCOPES)
  File "/usr/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 "/usr/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.

Specifications

  • Python version
    Python 3.7.4
  • OS: Mac

Workaround:
The workaround I've found for this issue:
https://stackoverflow.com/a/61892378/7856072
(this workaround proves that credentials.json is the correct file for authorization and account has all necessary rights).

主要語言
Python
星號
1.4k
分支
917
平均合併
3 分鐘
30 天內合併 PR
1

環境準備

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

googleworkspace/python-samples 的其他 Issue

查看 googleworkspace/python-samples 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。