Credentials.from_authorized_user_file refresh_token is missing
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 2/5
- Temps estimé
- 1-3 heures
- Accessibilité débutants
- 25/100
- Type d'issue
- Documentation
- Clarté
- Plutôt claire
- Activité
- À l'abandon
- Stack technique
- json, python
- Domaine
- authentication
Piste de recherche
The traceback points to quickstart.py calling Credentials.from_authorized_user_file('token.json', SCOPES), which raises from from_authorized_user_info in google/oauth2/credentials.py. The reporter's token.json is a downloaded OAuth client secrets file with an 'installed' key, not an authorized-user token, so start by checking how the quickstart tells users to create token.json. Done means the quickstart or its error path makes that mistake clear, which needs a maintainer decision on the intended fix.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
Expected Behavior
quickstart.py script will give me the last 10 login as described here:
https://developers.google.com/admin-sdk/reports/v1/quickstart/python
Actual Behavior
I'm trying to run the quickstart.py with a downloaded token.json for Desktop apps.
{
"installed": {
"client_id": "************.apps.googleusercontent.com",
"project_id": "sentinel-314815",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_secret": "*************",
"redirect_uris": [
"urn:ietf:wg:oauth:2.0:oob",
"http://localhost"
]
}
}
It gives me the following erro:
$ python quickstart.py
Traceback (most recent call last):
File "quickstart.py", line 50, in <module>
main()
File "quickstart.py", line 20, in main
creds = Credentials.from_authorized_user_file('token.json', SCOPES)
File "/home/zfejer/.local/lib/python3.8/site-packages/google/oauth2/credentials.py", line 326, in from_authorized_user_file
return cls.from_authorized_user_info(data, scopes)
File "/home/zfejer/.local/lib/python3.8/site-packages/google/oauth2/credentials.py", line 277, in from_authorized_user_info
raise ValueError(
ValueError: Authorized user info was not in the expected format, missing fields client_secret, client_id, refresh_token.
Seems like the refresh_token is missing from my token.json. I've just generated the token.json.
Steps to Reproduce the Problem
- follow the instruction on the page above
Specifications
- Python version (
python --version) Python 3.8.5 - OS (Mac/Linux/Windows) Ubuntu 20.04 on WSL2 (5.4.72-microsoft-standard-WSL2)
- Langage dominant
- Python
- Étoiles
- 1.4k
- Forks
- 917
- Merge moyen
- 3 min
- PR mergées (30 j)
- 1
Préparer son environnement
- Aucun Dockerfile ni fichier Docker Compose
- Propose un modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de googleworkspace/python-samples
-
ايقاف البحث الأمنPeut-être à nouveau libre @sqrrrl l’a pris il y a 400 jours, et aucune pull request n’est ouverte. Ouverte
googleworkspace/python-samples#2434 · 1 personne assignée ·
-
Slow Uploads using Google Drive API with PythonPeut-être à nouveau libre @sqrrrl l’a pris il y a 740 jours, et aucune pull request n’est ouverte. Ouverte
googleworkspace/python-samples#1852 · 1 commentaire · 1 personne assignée ·
-
403 error from google after a few successful runs of my codePeut-être à nouveau libre @vinay-google l’a pris il y a 912 jours, et aucune pull request n’est ouverte. Ouverte
googleworkspace/python-samples#1424 · 1 personne assignée ·
-
How to see the progress of files which is getting uploadedPeut-être à nouveau libre @vinay-google l’a pris il y a 928 jours, et aucune pull request n’est ouverte. Ouverte
googleworkspace/python-samples#1404 · 1 personne assignée ·
-
Phyton SamplesPeut-être à nouveau libre @PierrickVoulet l’a pris il y a 975 jours, et aucune pull request n’est ouverte. Ouverte
googleworkspace/python-samples#1279 · 1 personne assignée ·
Toutes les issues de googleworkspace/python-samples
Issues similaires
-
Difficulté 2/5 1-3 heures Accessibilité débutants 88/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 68/100
readthedocs/readthedocs-builder#73 ·
Les mainteneurs répondent en général sous 1 jour
-
area: ci bug good first issue help wanted
Difficulté 2/5 1-3 heures Accessibilité débutants 84/100
hffgzktbcc-blip/ounce-core#484 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
bug documentation
Difficulté 2/5 1-3 heures Accessibilité débutants 73/100
vllm-project/vllm-torchtpu#3395 ·
Les mainteneurs répondent en général sous 1 jour
-
Hermes plugin: MITM-domain discovery misses the model: block (provider/base_url nested under model:) — traffic blind-tunnels silently, zero compressionPeut-être pris Une pull request liée à cette issue est ouverte ou déjà fusionnée. Ouvertebug
Difficulté 2/5 1-3 heures Accessibilité débutants 66/100
ranxianglei/billion-context#7063 ·
Les mainteneurs répondent en général sous 1 jour