Embed stream after login

Hey devs :slight_smile:

There is a code to embed a stream channel :

<script type="text/javascript">
new Twitch.Embed("twitch-embed", {
width: 854,
height: 360,
 channel: "channel_name"

Is there any way I can pimp my code, so the channel name will actually appear, after user logins with twitch authenticator?

Thanks, a lot :slight_smile:

Embedding Twitch | Twitch Developers Look at: Working with Events. It tells you you can add an event listener.

var embed = new Twitch.Embed('twitch-embed', {
  channel: 'monstercat'

embed.addEventListener(Twitch.Embed.AUTHENTICATE, function(user) {
  console.log(user.login + ' just logged in');

You an do other things with that user object on authenticate other than logging it to the console you can modify an HTML to display what you need.

document.getElementById(“SOME_ID_OF_A_DIV”).innerHTML = user;

Thanks mate.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.