Is there a way to get streamer ID via the JavaScript Helper?

window.Twitch.ext.onAuthorized(
    function(auth){
        var parts=auth.token.split(".");
        var payload=JSON.parse(window.atob(parts[1]));
        var streamer_id = payload.channel_id;
    }
);

Also:

var streamer_id = payload.opaque_user_id.replace('U', '');

A broadcaster’s token is set with “U” + his Twitch user ID, to avoid confusing his opaque ID with his user ID when he is a viewer.

Can also cross check that

payload.role == 'broadcaster'

To see if the ID’s below to the streamer that the extension is installed on

1 Like