The IRC guide is a common pain point for new developers, it throws you to the third party token generator rather than teaching you how to autheticate. Generally you shouldn’t rely on someone elses generate as the generator could disappear at any moment and then your token is poof/gone.
Hence your “I’m stuck” since you started running before you could walk.
And Every 60 days you’ll need to manually do it all over again. (As you have generated an implicit auth token) And you might not notice the downtime in your system until you’ve been down for a while…
So, Lets start at the beginning:
Twitch uses oAuth to Grant access to between a user account and a ClientID.
User oAuth will involve sending the user to a website you control, to click a link and choose to allow (or disallow) access to the account.
That link will specify the permissions (aka scopes) that you need
For regular user oAuth flow:
The user then returns to your website with a ?code in the URL
You then exchange the ?code for an access token and a refresh token.
You can then use that Access Token to access Twitch until the token expires.
When the token expires you then use the refresh token to get a new access token (and possibly a new refresh token)
So, you would collect the access token and refresh token into a storage system (flat file or database)
And refresh as needed.
If the refresh dies then you’ll need to manually seed the system with a new token.
With the flow you have used (someone elses generator), this is known as Implicit Auth. this generates an #access_token but it cannot be refresh.
Currently a Twitch Regular User token is valid for four hours. But you can refresh it forever. In the context of a chat bot you only need the token to be valid when the bot initially connects to chat.
The implicit/always manual token is good for 60 days. But you’ll need to manually make a new token.
There is a third type of token (App Access) which is only useful to read public data so we won’t cover that in this post.
So what you need to do, is add to your nodeJS app (since you mentioned you are already using node) a web page that creates the outbound <a href with the scopes you need.
That nodeJS app will need to provide a webserver (running on whatever port since we are using localhost here). The TwitchCLI for example uses http://localhost:3000 so you could do the same.
I have written a nodeJS example for user authentcation that may help you out
This code example will cover how to generate a token. But not storage or refreshing of that token. The Exmaple just holds the token in session memory.
And the documentation for this kind of auth is here
Scopes/permissions are covered
And refresh here, which is just a “simple” HTTP Post Request