Periodically play !gacha on 9arm channel
-
Create Twitch developer OAuth application : https://dev.twitch.tv/console/apps
- Name : Use any name
- OAuth Redirect URLS : Use any valid URL eg.
http://localhost/oauth - Category : Chat Bot
- Note
Client ID&Client Secret
-
Set
Client ID&Client Secretin.env, save as.env.localto prevent commiting to Git. -
Get OAuth Authorization Code
-
Replace
Client ID&OAuth Redirect URLin this url, then access through browser.https://id.twitch.tv/oauth2/authorize?client_id=YOUR_CLIENT_ID&redirect_uri=YOUR_REDIRECT_URL&response_type=code&scope=chat:read+chat:edit -
Authenticate then get Authorization Code via
codequery string after redirecthttp://localhost/oauth?code=YOUR_AUTH_CODE&scope=chat%3Aread+chat%3Aedit
-
-
Get OAuth Access Token & Refresh Token
-
Replace
Client ID,Client Secret,Redirect URL, andAuthorization Codein this url:https://id.twitch.tv/oauth2/token?client_id=YOUR_CLIENT_ID&client_secret=YOUR_CLIENT_SECRET&code=YOUR_AUTH_CODE&grant_type=authorization_code&redirect_uri=YOUR_REDIRECT_URL -
Request tokens from URL above via
POSTrequest (UsePostman,Insomnia,cURL,wget, etc.) -
You'll get
access_token&refresh_tokenvia JSON{ "access_token": "abcdha31dpldqi4m8ucf2cfqhh72t9", "expires_in": 12345, "refresh_token": "wxyz4h7t3v4t0ngdl3ri6se4b6qvava4xc931rxro2leh6at9h", "scope": ["chat:edit", "chat:read"], "token_type": "bearer" }
-
-
Save this file as
tokens.json -
yarn installornpm install -
yarn devornpm run dev