Authentication is covered here
You should probably generate a user access token
There is a Node and PHP example at
That might be of use
TLDR:
- Create a URL that goes to Twitch specifiying your client ID and the required scopes. (and other fields)
- Get the streamers to click that link
- They go to Twitch, they accept the connection between your Application and their account
- They are redirected to your website with a
code - Exchange the
codefor an access and refresh token
Then use that access token to connect to pubsub, and refresh the token when the access token dies/you get disconnected from PubSub.