Twitch bot - 401

No

The channel you want to read the moderators of, has to login with twitch with your client ID.

So the streamers needs to grant permission to your client to read moderators

Who owns the clientID is irrelevant.

So I have a client ID foo
If I want to read cohhcarnage’s moderators, I ask cohhcarnage to go to my website and login with Twitch, granting the relevant scopes.

So cohhcarnage creates a link between his account and my clientID
Then I use the resultant oAuth token to read cohhcarnage’s moderators.

cohhcarnage does not have to create his own clientID.
Just needs to gran access to my clientID to his account

A user access token is generated from clientID/clientsecret/user interaction set

So:

  • user goes to your website example: https://chatbot.barrycarlyon.co.uk/
  • user clicks on “Connect with Twitch” in this case the “New/Refresh Broadcaster Login” button, as this is the “main scopes set” link for my chatbot
  • user is sent to Twitch
  • user accepts (or declines) the link request betwee their account and my clientID.
  • user is redirected back to my website
  • I grab the ?code and with the client secret, exchange it for an access token and refresh token.

That in a nutshell is how oAuth works.

This sounds like you generated a client credentials token aka app access token which doesn’t represent a Twitch user. So cannot be used to call “Get Channel Moderators”

See Authentication | Twitch Developers