fucking piece of shit Oauth fucking work you asshole

This commit is contained in:
CatAClock 2025-06-01 10:17:36 -07:00
parent d119ceac4a
commit b7e03d377b

View file

@ -559,12 +559,12 @@ export async function RefreshTokens() {
let WellKnown = GetPDSWellKnown();
let body = await WellKnown.then((response) => response.json());
let header = await WellKnown.then((response) => response.headers.get("dpop-nonce"));
HandleError(body, header);
await HandleError(body, header);
// Create varaibles, be aware of waits because of internet.
let DPoP = await ClientDPoPToken("POST", WellKnown.token_endpoint);
let DPoP = await ClientDPoPToken("POST", body.token_endpoint);
// Token refresh
let Var = await localStorage.getItem(Variables.BlueskyRefreshToken);
let Auth = await ReauthRequest(WellKnown.token_endpoint, Var, DPoP).then((response) => response.json());
let Auth = await ReauthRequest(body.token_endpoint, Var, DPoP).then((response) => response.json());
// Save the tokens and be done
await localStorage.setItem(Variables.BlueskyAccessToken, Auth.access_token);
await localStorage.setItem(Variables.BlueskyRefreshToken, Auth.refresh_token);
@ -572,7 +572,7 @@ export async function RefreshTokens() {
async function HandleError(body, header) {
await localStorage.setItem(Variables.BlueskyNonce, header);
if (body.message.includes("claim timestamp check failed")) {
if (body.message != undefined && body.message.includes("claim timestamp check failed")) {
await RefreshTokens();
}
}