a collection of lightweight TypeScript packages for AT Protocol, the protocol powering Bluesky
atproto bluesky typescript npm
101
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix(oauth-browser-client): check if retried request returns a new nonce

Mary 9870d552 1fd2796a

+20 -1
+7
.changeset/wet-bears-try.md
··· 1 + --- 2 + '@atcute/oauth-browser-client': patch 3 + --- 4 + 5 + check if retried request returns a new nonce 6 + 7 + 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
··· 167 167 const nextRequest = new Request(input, init); 168 168 nextRequest.headers.set('dpop', nextProof); 169 169 170 - return await fetch(nextRequest); 170 + const retryResponse = await fetch(nextRequest); 171 + 172 + // Check if the server returned another new nonce in the retry response 173 + const retryNonce = retryResponse.headers.get('dpop-nonce'); 174 + if (retryNonce !== null && retryNonce !== nextNonce) { 175 + try { 176 + nonces.set(origin, retryNonce); 177 + } catch { 178 + // Ignore write errors 179 + } 180 + } 181 + 182 + return retryResponse; 171 183 } 172 184 }; 173 185 };