Bug fix
This commit is contained in:
parent
8c386c6701
commit
d83870f783
1 changed files with 1 additions and 8 deletions
|
@ -565,20 +565,13 @@ export async function RefreshTokens() {
|
|||
let Auth = ReauthRequest(WellKnown.token_endpoint, Var, DPoP);
|
||||
let body = await Auth.then((response) => response.json());
|
||||
let header = await Auth.then((response) => response.headers.get("dpop-nonce"));
|
||||
if (body.hasOwnProperty("error_description") && body.error_description.includes("DPoP nonce mismatch")) {
|
||||
localStorage.setItem(Variables.BlueskyNonce, header);
|
||||
DPoP = await ClientDPoPToken("POST", WellKnown.token_endpoint);
|
||||
body = await ReauthRequest(WellKnown.token_endpoint, Var, DPoP).then((response) => response.json());
|
||||
}
|
||||
// Save the tokens and be done
|
||||
localStorage.setItem(Variables.BlueskyAccessToken, body.access_token);
|
||||
localStorage.setItem(Variables.BlueskyRefreshToken, body.refresh_token);
|
||||
}
|
||||
|
||||
async function HandleError(body, header) {
|
||||
if (body.message.includes("DPoP nonce mismatch")) {
|
||||
await localStorage.setItem(Variables.BlueskyNonce, header);
|
||||
}
|
||||
await localStorage.setItem(Variables.BlueskyNonce, header);
|
||||
if (body.message.includes("claim timestamp check failed")) {
|
||||
await RefreshTokens();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue