The cool thing about web games is that you can see the source code in your browser! Feel free to poke around, most of the Twitch integration stuff is in main.js. Basically, when you click the Login to Twitch button, you're redirected to twitch.tv who asks if you authorize the login. They then redirect back to my site with an access_token parameter in the url hash. I use that token to connect to their chat irc websocket and send some messages to use that token to read the chat. Then as messages are sent to the websocket, I parse them to see if they are messages relevant to the game and act on them.