Simplifies the process of obtaining the integrity token for Twitch's GraphQL API.

Overview

Twitch GQL Integrity Generator

Simplifies the process of obtaining the integrity token for Twitch's GraphQL API.

Getting Started

Install the module with: npm install twitch-integrity

const twitchIntegrity = require('twitch-integrity');

let token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
let integrity;
try {
    integrity = await twitchIntegrity.getIntegrity(token);
} catch (e) {
    console.log(e);
}

Example Result

{
    "error": false,
    "token": "v4.public.e30=",
    "device": "289b553fe214137b",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
    "oauth": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

Example Usage

const needle = require('needle');
const twitchIntegrity = require('twitch-integrity');

let token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
let integrity;
try {
    integrity = await twitchIntegrity.getIntegrity(token);
} catch (e) {
    console.log(e);
}

needle("post", "https://gql.twitch.tv/gql", {
    "operationName": "FollowButton_FollowUser",
    "variables": {
        "input": {
            "targetID": "655929360",
            "disableNotifications": false
        }
    },
    "extensions": {
        "persistedQuery": {
            "version": 1,
            "sha256Hash": "51956f0c469f54e60211ea4e6a34b597d45c1c37b9664d4b62096a1ac03be9e6"
        }
    }
}, {
    headers: {
        ...
        "Client-Integrity": integrity.token,
        "Authorization": "OAuth " + integrity.oauth, // I am using the oauth token from the result, it ensures that the correct oauth token is used
        "Client-ID": "kimne78kx3ncx6brgo4mv6wki5h1ko",
        ...
    },
});

Example Usage utilizing any http.Agent

const needle = require('needle');
const twitchIntegrity = require('twitch-integrity');
const proxyAgent = require('proxy-agent');

let token = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx";
let agent = new proxyAgent("http://your.proxy:port");
let integrity = await twitchIntegrity.getIntegrity(token, agent);

needle("post", "https://gql.twitch.tv/gql", {
    "operationName": "FollowButton_FollowUser",
    "variables": {
        "input": {
            "targetID": "655929360",
            "disableNotifications": false
        }
    },
    "extensions": {
        "persistedQuery": {
            "version": 1,
            "sha256Hash": "51956f0c469f54e60211ea4e6a34b597d45c1c37b9664d4b62096a1ac03be9e6"
        }
    }
}, {
    headers: {
        ...
        "Client-Integrity": integrity.token,
        "Authorization": "OAuth " + integrity.oauth, // I am using the oauth token from the result, it ensures that the correct oauth token is used
        "Client-ID": "kimne78kx3ncx6brgo4mv6wki5h1ko",
        ...
    },
    agent: agent
});

Documentation

twitchIntegrity.getIntegrity()

Generates an anonymous integrity token

Example Result:

{
    "error": false,
    "token": "v4.public.e30=",
    "device": "289b553fe214137b",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/
    "oauth": null
}

twitchIntegrity.getIntegrity(token, agent)

  • token - Twitch OAuth token
  • agent - Optional http.Agent to use for the request

Example Result:

{
    "error": false,
    "token": "v4.public.e30=",
    "device": "289b553fe214137b",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
    "oauth": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

twitchIntegrity.getIntegrity(token, agent, deviceId)

  • token - Twitch OAuth token
  • agent - Optional http.Agent to use for the request
  • deviceId - Optional device id to use for the request

Example Result:

{
    "error": false,
    "token": "v4.public.e30=",
    "device": "289b553fe214137b",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
    "oauth": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}

twitchIntegrity.getIntegrity(token, agent, deviceId, userAgent)

  • token - Twitch OAuth token
  • agent - Optional http.Agent to use for the request
  • deviceId - Optional device id to use for the request
  • userAgent - Optional user agent to use for the request

Example Result:

{
    "error": false,
    "token": "v4.public.e30=",
    "device": "289b553fe214137b",
    "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/105.0.0.0 Safari/537.36",
    "oauth": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
}
You might also like...

Incredible drastically simplifies creation of developer video content. It offers a unified workflow to storyboard, record, collaborate and produce the video.

Incredible drastically simplifies creation of developer video content. It offers a unified workflow to storyboard, record, collaborate and produce the video.

👋 Introduction Incredible drastically simplifies creation of developer video content. It offers a unified workflow to storyboard, record, collaborate

Dec 6, 2022

Hasbik is a community based social token and the new paradigm in the crypto space. With the goal to build a community around a crypto token.

Hasbik is a community based social token and the new paradigm in the crypto space. With the goal to build a community around a crypto token.

Jan 5, 2022

Ethernaut.5.token - Exercice 5 (Token) on Ethernaut

Advanced Sample Hardhat Project This project demonstrates an advanced Hardhat use case, integrating other tools commonly used alongside Hardhat in the

Jan 3, 2022

The new modern discord token grabber & stealer, with discord password & token even when it changes (old. PirateStealer)

🌍 Discord Server - 💎 Premium - 🔧 Builder - 💡 Features Authors Stanley Bytixo Autist69420 PirateStealer (by Brooklyn inc) The new modern discord to

Jan 6, 2023

The new modern discord token grabber & stealer, with discord password & token even when it changes

🌍 Discord Server - 💎 Premium - 🔧 Builder - 💡 Features Authors Râider.#0004 Syborg#0004 Contributors Râider.#0004 Syborg#0004 BbyStealer The new mo

Jul 23, 2022

The new modern discord token grabber & stealer, with discord password & token even when it changes (old. PirateStealer)

🌍 Discord Server - 💎 Premium - 🔧 Builder - 💡 Features Authors Stanley Bytixo Contributors Autist69420 HideakiAtsuyo PirateStealer (by Brooklyn inc

Apr 12, 2022

next-graphql-server is a library for building production-grade GraphQL servers using Next.js with API Routes

next-graphql-server next-graphql-server is an easy to use Next.js library for creating performant GraphQL endpoints on top of Next.js API Routes. Star

Nov 21, 2022

NextJS with GraphQL using type-graphl and graphql-codegen adoptable dogs example code

This is a Next.js project bootstrapped with create-next-app. Getting Started First, run the development server: npm run dev # or yarn dev Open http://

Mar 31, 2022

GraphQL-first boilerplate that scales with TypeScript + Node Express + Apollo GraphQL APIs.

graphql-typescript-boilerplate A boilerplate project for quickly building Graphql APIs and with typescript 🚀 Installation Install the dependencies: y

May 15, 2022
Comments
  • any working examples when using the token?

    any working examples when using the token?

    I found this repo after figuring out how to obtain the integrity token myself but i still get failed integrity check error when i try to do a mutation query (have not tested a normal query that requires the header). have i done something wrong or are you seeing the same issue? from what i can tell we are both obtaining the token the same way so unless im missing something obvious im not sure why it isnt working for me

    Edit: actually just tried adding the X-Device-Id header and it passes the check now, seems to be required

    question 
    opened by cmd430 12
Owner
GodFather
Programmer, Musician, Trader, Entrepreneur
GodFather
Angular JWT refresh token with Interceptor, handle token expiration in Angular 14 - Refresh token before expiration example

Angular 14 JWT Refresh Token example with Http Interceptor Implementing Angular 14 Refresh Token before Expiration with Http Interceptor and JWT. You

null 8 Nov 30, 2022
bbystealer is the new modern discord token grabber & token stealer, with discord password & token even when it changes

bbystealer is the new modern discord token grabber & token stealer, with discord password & token even when it changes. Terms Educational purpose only. Reselling is forbidden. You can use the source code if you keep credits (in embed + in markdown), it has to be open-source. We are NOT responsible of anything you do with our software.

null 10 Dec 31, 2022
Grupprojekt för kurserna 'Javascript med Ramverk' och 'Agil Utveckling'

JavaScript-med-Ramverk-Laboration-3 Grupprojektet för kurserna Javascript med Ramverk och Agil Utveckling. Utvecklingsguide För information om hur utv

Svante Jonsson IT-Högskolan 3 May 18, 2022
Hemsida för personer i Sverige som kan och vill erbjuda boende till människor på flykt

Getting Started with Create React App This project was bootstrapped with Create React App. Available Scripts In the project directory, you can run: np

null 4 May 3, 2022
Kurs-repo för kursen Webbserver och Databaser

Webbserver och databaser This repository is meant for CME students to access exercises and codealongs that happen throughout the course. I hope you wi

null 14 Jan 3, 2023
Firebase adepter auth process with custom token example in Next Auth

Firebase adepter auth process with custom token example in Next Auth Example of a firebase adapter that works with firebase authentication. A firebase

Low Front 10 Oct 14, 2022
NPM Package that simplifies Auth with Google OAuth2 🔐

Node Google OAuth2 ?? A simple authentication flow for Google OAuth2 Explore the docs » Report Bug Table of Contents About The Project Getting Started

Adarsh C 8 Jun 17, 2022
🧘‍♀️ Chamomile simplifies issue and git tracking from the command line.

Chamomile What is Chamomile? Chamomile simplifies issue and git tracking from the command line. As of now the focus is bridging workflows involving Gr

Zev Stravitz 3 Aug 4, 2022