clauddy 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/auth.js +7 -1
- package/package.json +1 -1
package/auth.js
CHANGED
|
@@ -124,7 +124,13 @@ async function refresh() {
|
|
|
124
124
|
client_id: CLIENT_ID,
|
|
125
125
|
}),
|
|
126
126
|
})
|
|
127
|
-
if (!res.ok)
|
|
127
|
+
if (!res.ok) {
|
|
128
|
+
// a rejected grant (expired/revoked refresh token) means the session is
|
|
129
|
+
// dead — surface it as 401 so callers clear the token and prompt login.
|
|
130
|
+
// transient failures (429, 5xx) keep their status so we retry, not logout.
|
|
131
|
+
const dead = res.status === 400 || res.status === 403
|
|
132
|
+
throw Object.assign(new Error('refresh failed'), { status: dead ? 401 : res.status })
|
|
133
|
+
}
|
|
128
134
|
const j = await res.json()
|
|
129
135
|
save({
|
|
130
136
|
access_token: j.access_token,
|