Skip to main content

Twitch Social Login with Web3Auth

Create a Twitch app

  1. Follow Twitch's registration instructions to (register your app)[https://dev.twitch.tv/console/apps/create].

  2. Paste the following as a Redirect URI into the "OAuth Redirect URLs" field.

    Twitch OAuth2.0 App Dashboard

  3. After creation of your Twitch app, click Manage

    Twitch OAuth2.0 App Manage

  4. Obtain the Client ID

    Twitch OAuth2.0 App Manage

Create a Twitch verifier

  • Go to the Web3Auth dashboard and select your project. Click on the Custom Authentication tab, then click on the Create Verifier button to create a new verifier.

    Custom Authentication Dashboard

  1. Create a verifier for your Twitch application by selecting Twitch as the Login provider from this modal. Login Providers list on Web3Auth Dashboard
  2. Paste the Client ID from the Twitch App(above) to the Client ID field and click on Create. Twitch Client ID on Web3Auth Dashboard

Example

import { AuthAdapter } from "@web3auth/auth-adapter";
import { CHAIN_NAMESPACES } from "@web3auth/base";

// Create AuthAdapter instance once you have created Web3Auth instance
const authAdapter = new AuthAdapter({
adapterSettings: {
loginConfig: {
twitch: {
verifier: "w3a-twitch-demo", // Pass the Verifier name here
typeOfLogin: "twitch", // Pass on the login provider of the verifier you've created
clientId: "3k7e70gowvxjaxg71hjnc8h8ih3bpf", // Pass on the Twitch `Client ID` here
},
},
},
});

web3AuthInstance.configureAdapter(authAdapter);

// Initialize Modal
await web3AuthInstance.initModal();

// Login with Twitch
await web3AuthInstance.connect();