Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Device-flow refresh token rejected immediately: 400 "refresh_token is invalid" on first refresh

Abierto
#406 3 comentarios 0 reacciones 0 asignados Ver en GitHub

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
32/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
node.js, typescript

Línea de trabajo

Start from the refresh path the report names: AuthResource.refreshToken and createAccessTokenProvider in @stripe/link-cli. Reproduce by running link-cli auth login, moving expires_at into the past in config.json, then link-cli payment-methods list --verbose to capture the POST /device/token request and body. Because the same code path works in 0.25.1, first establish whether the 400 comes from the server for a token the CLI stored correctly, and read the apiFetch retry path in #294. Done means a device-flow refresh token survives the one-hour access-token expiry.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

Summary

A refresh token issued by the device flow is rejected immediately. POST https://login.link.com/device/token with grant_type=refresh_token returns 400 {"error":{"message":"refresh_token is invalid"}}, even when the refresh token is brand new and has never been used.

The result: every link-cli session dies one hour after login, when the access token expires. The user must approve a new device login before each purchase.

Reproduction (2026-10-04, ~16:17 UTC)

  1. link-cli auth logout, then link-cli auth login --client-name "Hermes on Oren".
  2. Approve the device login in the Link app. auth status returns authenticated: true, scope userinfo:read payment_methods.agentic, expires_in 3600.
  3. link-cli user-info retrieve and link-cli payment-methods list succeed with the new access token.
  4. About 2 minutes after login, force a refresh (set expires_at in the past in config.json, then run link-cli payment-methods list). Result: Token refresh failed (400): refresh_token is invalid. --verbose shows the request is POST /device/token with grant_type=refresh_token, the stored refresh token (liwlrefresh_...), and client_id=lwlpk_U7Qy7ThG69STZk.
  5. Restore the original expires_at: the access token still works. Only the refresh token is rejected.

The refresh token was used exactly once, from one process on one machine. No other machine or process holds it.

History

  • In August 2026, one login kept working for weeks, so refresh worked then (CLI ~0.10-0.15).
  • Since about 2026-09-25, every refresh fails with this error, on every new login.

Environment

  • @stripe/link-cli 0.19.0. The refresh code path (AuthResource.refreshToken, createAccessTokenProvider) is identical in 0.25.1.
  • Node 26, macOS 26.

Related

  • auth status reports authenticated: true while the refresh token is already unusable, so agents only discover the dead session at payment time.
  • #294: the 401-retry path in apiFetch can re-send a POST. A refresh failure makes that path more likely to be hit.
Lenguaje dominante
TypeScript
Estrellas
842
Forks
136
Merge medio
1 d 6 h
PR fusionados (30 d)
88

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de stripe/link-cli

Todos los issues de stripe/link-cli

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.