`gws auth login` keeps the old token cache, so API calls use a token from the previous grant
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 80/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- rust
- Área
- authentication, cli
Línea de trabajo
Comienza en crates/google-workspace-cli/src/auth_commands.rs en handle_login_inner, donde se guardan las nuevas credenciales, y compáralo con handle_logout, que ya elimina la caché. Añade la eliminación de token_cache.json y sa_token_cache.json después del guardado, luego revisa select_scope en main.rs para confirmar cómo se indexan los tokens en caché por conjunto de scopes. Terminado cuando iniciar sesión de nuevo con un scope más amplio y llamar a un método de Gmail ya no devuelva 403, con las pruebas de autenticación pasando.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
This report was written by an AI coding agent (Claude Code) that diagnosed the fault on its user's machine. "The agent" below is that agent.
Observed
On the user's machine, after gws auth login, API calls kept failing with 403 errors although gws auth status reported the correct scopes and "token_valid": true.
$ gws gmail users drafts create --params '{"userId":"me"}' --json '{"message":{"raw":"..."}}'
{
"error": {
"code": 403,
"message": "Missing access token for authorization. Request: MailboxService.CreateDraft",
"reason": "forbidden"
}
}
$ gws gmail users messages modify --params '{"userId":"me","id":"..."}' --json '{"addLabelIds":["STARRED"]}'
{
"error": {
"code": 403,
"message": "Request had insufficient authentication scopes."
}
}
In the same state, gmail users messages list, gmail users labels create and gmail users messages insert succeeded, and gws auth status listed https://www.googleapis.com/auth/gmail.modify.
The files in the config directory showed that the login had written new credentials and left the cache:
credentials.enc 10:47
token_cache.json 10:45
The agent moved token_cache.json aside, and every call then succeeded.
Expected
gws auth login replaces the credentials, so the next API call uses a token from the new grant.
Cause
handle_login_innerincrates/google-workspace-cli/src/auth_commands.rssaves the new credentials and does not touchtoken_cache.json. Onlyhandle_logoutdeletes it.select_scopeinmain.rsasks for the first scope of each method, and the cache stores one token for each scope set. Every Gmail method listshttps://mail.google.com/first, so all Gmail calls share one cached entry.gws auth statusgets a new token for itstokeninfocheck, so it reports the new grant while API calls still use the cached token.
Steps to reproduce
The agent observed the end state above and did not run this exact sequence:
gws auth loginwith a narrow scope set, then call a Gmail method so a token is cached.gws auth loginagain with a wider scope set.- Call a method that needs the new scope. It fails with a 403 until the cached token is replaced.
Proposed fix
Delete token_cache.json and sa_token_cache.json in the login path, after the new credentials are saved.
Related
#188 reported the same symptom and was closed with a manual workaround (delete the stale cache).
Environment
- gws 0.22.5, built from source
- macOS, keyring backend
the scratch file is removed; the text on stdout is the only copy
- Lenguaje dominante
- Rust
- Estrellas
- 32.3k
- Forks
- 2k
- Merge medio
- 16 h 3 min
- PR fusionados (30 d)
- 1
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de googleworkspace/cli
-
auth export masks secrets by default with no warning; consumers fail later with invalid_clientAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 64/100
googleworkspace/cli#983 ·
Los mantenedores suelen responder en 1 día
-
Replace gemini with agyAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 82/100
googleworkspace/cli#958 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
googleworkspace/cli#921 ·
Los mantenedores suelen responder en 1 día
-
Add cli to awesome-ai-plugins?Abierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
googleworkspace/cli#920 ·
Los mantenedores suelen responder en 1 día
-
docs(gmail): the --draft tip prints a send command that fails (users.drafts.send --body)Quizá libre de nuevo Un pull request para esta issue se cerró sin fusionarse. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
googleworkspace/cli#914 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de googleworkspace/cli
Issues similares
-
area:cli area:security bug priority:medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
rtk-ai/rtk#5127 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
status: new topic: ga4gh-sdk type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 1 día
-
comp-rbac
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
ClickHouse/ClickHouse#131875 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
Los mantenedores suelen responder en 1 día
-
bug(python): read_transaction raises TypeError on a Rewrite with rewritten indicesPosiblemente ocupada @Borg93 la tomó hoy. Abiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
lance-format/lance#11117 ·
Los mantenedores suelen responder en 2 días