···11+---
22+'@atcute/oauth-browser-client': patch
33+---
44+55+check if retried request returns a new nonce
66+77+in case the authorization server is set up to always return a new nonce every request.
+13-1
packages/oauth/browser-client/lib/dpop.ts
···167167 const nextRequest = new Request(input, init);
168168 nextRequest.headers.set('dpop', nextProof);
169169170170- return await fetch(nextRequest);
170170+ const retryResponse = await fetch(nextRequest);
171171+172172+ // Check if the server returned another new nonce in the retry response
173173+ const retryNonce = retryResponse.headers.get('dpop-nonce');
174174+ if (retryNonce !== null && retryNonce !== nextNonce) {
175175+ try {
176176+ nonces.set(origin, retryNonce);
177177+ } catch {
178178+ // Ignore write errors
179179+ }
180180+ }
181181+182182+ return retryResponse;
171183 }
172184 };
173185};