ext.onAuthorized never fires so token is always undefined in fetch requests

Sounds like you either

  • have a 404 error and your JS never loaded
  • you didn’t include the JS Helper library

The “simplest” example

index.html set to load in a given view

<html>
<head>
<script src="https://extension-files.twitch.tv/helper/v1/twitch-ext.min.js"></script>
<script src="script.js"></script>
</head>
<body>
Hello
</body>
</html>

script.js in the same directory as the HTML

window.Twitch.ext.onAuthorized((auth) => {
    console.log('got auth');
});