-
-
Save jkmartindale/c2a2cb83e6a2e889c7e3aa7b37b5fedc to your computer and use it in GitHub Desktop.
/* Twitch Quest Fixer v3.1 */ | |
const extensionID = "ehc5ey5g9hoehi8ys54lr6eknomqgr"; | |
const channel = location.pathname.slice(1).toLowerCase(); | |
const channelId = __APOLLO_CLIENT__.cache.data.data.ROOT_QUERY["channel({\"name\":\""+channel+"\"})"].__ref.split(":")[1]; | |
const pollDuration = 60000; | |
let authToken = __APOLLO_CLIENT__.cache.data.data["Channel:" + channelId].selfInstalledExtensions.filter(x => x.helixToken.extensionID == extensionID)[0].token.jwt; | |
grantPermission = async () => { | |
console.log("Attempting to grant permission automatically..."); | |
const integrityResponse = await (await fetch("https://gql.twitch.tv/integrity", { method: "post", headers: commonOptions.headers })).json(); | |
const integrity = integrityResponse.token; | |
const permissionResponse = await (await fetch("https://gql.twitch.tv/gql", { | |
method: "post", | |
headers: { | |
...commonOptions.headers, ...{ | |
"Client-Integrity": integrity | |
} | |
}, | |
body: JSON.stringify([{ | |
"operationName": "LinkUserMutation", | |
"variables": { | |
"channelID": channelId, | |
"extensionID": extensionID, | |
"token": authToken, | |
"showUser": true | |
}, | |
"extensions": { "persistedQuery": { "version": 1, "sha256Hash": "b5dfec96759d42ac5a24f79beec27bcdf90e936e0fac4f727b7ab36dadb6a22a" } } | |
}]) | |
})).json(); | |
console.log(permissionResponse); | |
newAuthToken = permissionResponse[0].data.extensionLinkUser.token.jwt; | |
if (newAuthToken) { | |
authToken = newAuthToken; | |
console.log("Looks like permission was successfully granted. You should see another message saying that you're earning ARP about 60 seconds from now."); | |
}; | |
} | |
handlePolling = () => { | |
fetch("https://alienware.jkmartindale.dev/?url=https://www.alienwarearena.com/twitch/extensions/track", { | |
method: 'GET', | |
headers: { | |
'x-extension-jwt': authToken, | |
'x-extension-channel': channelId | |
} | |
}) | |
.then(response => response.json()) | |
.then(async data => { | |
console.log(data); | |
/* Attempt to authorize extension if not authorized */ | |
if (data.state === "grant_permission") { | |
await grantPermission(); | |
}; | |
}) | |
.catch((err) => { | |
console.log(err); | |
}) | |
.finally(() => { | |
setTimeout(handlePolling, pollDuration); | |
}); | |
}; | |
handlePolling() |
I think it might be possible but it's a whole lot harder, and I'm in the middle of a cross-country move right now so I haven't been able to take a better look at it yet. The whole authorization flow is owned by Twitch and I don't know how their authentication works.
Fair enough. It was worth a try. I mean it IS my own fault for disabling its permission in the hopes that I can grant it back and maybe make the extension work again.
Anyway, thank you very much for the quick reply, AND for the magic code, of course.
Keep up the good work and have a good one!
Is there any way that you can provide a code to those of us who haven't granted the extension permission?
Had an idea come to me while I was cooking and it ended up being simpler than I thought. Try it out now.
Holy shit, dude! You're a genius!
Not only did the new code grant permission to the extension on its own, but it also helped me get my daily Twitch ARP with no issues.
Thank you SO MUCH!
Is there any way that you can provide a code to those of us who haven't granted the extension permission?
Because even though the code works, it only works if you've granted permission to the extension beforehand - something which I screwed up when removing its permission a few minutes ago in the hopes that I could probably make it work again by removing and granting it permission again afterwards. I'm a bit stuck here.
So basically is there a possibility for a code that grants the extension its permission through the console?