Device-flow refresh token rejected immediately: 400 "refresh_token is invalid" on first refresh
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 32/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- node.js, typescript
- Ambito
- authentication
Direzione di ricerca
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.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
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)
link-cli auth logout, thenlink-cli auth login --client-name "Hermes on Oren".- Approve the device login in the Link app.
auth statusreturnsauthenticated: true, scopeuserinfo:read payment_methods.agentic,expires_in3600. link-cli user-info retrieveandlink-cli payment-methods listsucceed with the new access token.- About 2 minutes after login, force a refresh (set
expires_atin the past inconfig.json, then runlink-cli payment-methods list). Result:Token refresh failed (400): refresh_token is invalid.--verboseshows the request isPOST /device/tokenwithgrant_type=refresh_token, the stored refresh token (liwlrefresh_...), andclient_id=lwlpk_U7Qy7ThG69STZk. - 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-cli0.19.0. The refresh code path (AuthResource.refreshToken,createAccessTokenProvider) is identical in 0.25.1.- Node 26, macOS 26.
Related
auth statusreportsauthenticated: truewhile the refresh token is already unusable, so agents only discover the dead session at payment time.- #294: the 401-retry path in
apiFetchcan re-send a POST. A refresh failure makes that path more likely to be hit.
- Lingua principale
- TypeScript
- Stelle
- 842
- Fork
- 136
- Merge medio
- 1g 6h
- PR unite (30g)
- 88
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di stripe/link-cli
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 4/5 3-5 giorni Idoneità per principianti 48/100
I maintainer di solito rispondono entro 1 giorno
-
bunx hangs after link-cli commands by implicitly starting a development serverForse già presa @awesamarth l’ha presa 34 giorni fa. Aperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 55/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 5/5 Più di una settimana Idoneità per principianti 35/100
stripe/link-cli#294 · 3 commenti ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di stripe/link-cli
Issue simili
-
fix(frontend): correct VITE_IS_DEVELPOMENT typo in shared/app.ts and align dev environment flagsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 75/100
vicharanashala/ajrasakha#1439 ·
I maintainer di solito rispondono entro 1 giorno
-
Add: TV5Monde AsieApertaapproved check:passed streams:add
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
backnotprop/plannotator#1932 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 Mezza giornata Idoneità per principianti 62/100
ibm-granite/granite.build#504 ·
I maintainer di solito rispondono entro 2 giorni
-
reproduced
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
anomalyco/opencode#55676 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno