auth: expose AccessToken expiration
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- rust
Línea de trabajo
Start by reading src/auth/src/token.rs and src/auth/src/credentials.rs, especially the token expiry tracking and conversion linked in the issue. Review #7391 and the semver concern described here to understand the proposed API shape. Done means callers can obtain the token and its optional expiration without adding a breaking field to AccessToken; add or update focused auth tests for known and unknown expirations.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Is your feature request related to a problem? Please describe.
I have a short-lived CLI that needs an access token on every run. It keeps the token in a private file between runs (much like gcloud's own token cache), so it needs to know when the token expires.
AccessToken only exposes token. The SDK tracks the expiry internally but drops it in the conversion, so the CLI can't get the lifetime from the SDK. Today it gets tokens from gcloud auth print-access-token and looks up the lifetime with the tokeninfo endpoint after each fetch.
Describe the solution you'd like
A way to get the expiration along with the token, or None when it isn't known. This was part of the original sketch in #2929, and #7391 implements it as a field. An Instant is fine for my use; I'd convert it to wall-clock time when saving.
One semver note: AccessToken has only public fields and isn't #[non_exhaustive], so adding any field, even a private one behind an accessor, breaks struct-literal construction (for example in mocks of AccessTokenCredentialsProvider). cargo-semver-checks reports that as major (constructible_struct_adds_private_field). A new method that returns a #[non_exhaustive] type with the token and its expiry would leave AccessToken unchanged.
The other Google auth libraries already expose this:
- Go:
auth.Token.Expiry - Java:
AccessToken.getExpirationTime() - Python:
Credentials.expiry
Describe alternatives you've considered
- Looking up tokeninfo after each fetch (current workaround): an extra request per token.
- Assuming a one-hour lifetime: unsafe, since lifetimes vary by credential type.
- Fetching a fresh token in every process: works, but adds a token request to every run.
Additional context
On #7391 there was a question of whether this needs to be exposed at all. This is a case where the SDK's in-process cache can't help: the process exits before the token could be reused.
- Lenguaje dominante
- Rust
- Estrellas
- 972
- Forks
- 163
- Merge medio
- 1 d 13 h
- PR fusionados (30 d)
- 202
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin 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 googleapis/google-cloud-rust
-
api: storage
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
googleapis/google-cloud-rust#7344 ·
Los mantenedores suelen responder en 1 día
-
BytesValue in Any rejects unpadded and URL-safe base64Posiblemente ocupada @akasakariko la tomó hace 15 días. Abiertopriority: p2 type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
googleapis/google-cloud-rust#6714 · 1 comentario · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
type: bug
Dificultad 2/5 Medio día Aptitud para principiantes 75/100
googleapis/google-cloud-rust#6710 ·
Los mantenedores suelen responder en 1 día
-
type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
googleapis/google-cloud-rust#6709 ·
Los mantenedores suelen responder en 1 día
-
type: bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
googleapis/google-cloud-rust#6707 ·
Los mantenedores suelen responder en 1 día
Todos los issues de googleapis/google-cloud-rust
Issues similares
-
bug UI
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
wardian-app/Wardian#1746 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
jlcodes99/cockpit-tools#3125 ·
Los mantenedores suelen responder en 2 días
-
bug user-sprint
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Vondor/KassenSturz#967 ·
Los mantenedores suelen responder en 1 día
-
area/ci
Dificultad 1/5 Menos de una hora Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
[BUG] Incremental sync warns "no stored highest_uid" on every round for folders with no new mailAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
rustmailer/bichon#411 ·