I need help with the oauth authentication… I use a dedicated twitch account for my bot. I have a client_id, client_secret, and and oauth:<token> to connect to the IRC and that works just fine.
Now I want to make my bot channel point redemption aware, and for this I need to subscribe to the pubsub_topic, for which I totally and utterly fail to get the token. I have read the documentations on the different outh auth flows, tried and failed so many things… From what I understand I must authenticate my bot account on my broadcaster account to read the channel point redemtions.
For that I added Twitch OAuth Token Generator as the redirect URL to my bot’s app over at Twitch Developers (on the bot’s twitch account), and then accessed /tokengen from a browser session with my broadcaster account, entered my bot’s app client_id, entered channel:read:redemptions as scope and authenticated my bot user to read channel point redemtions on my broadcaster account. I get a token back, but regardless if I enter that as <token> or oauth:<token> in my code, I always get
I have the feeling that I took a wrong turn somewhere, but can’t see where…
I think my errors are before the code, with the authentication. Things I don’t understand (yet): do I need a separate redirect_uri for my bot (which is basically just a user reacting to commands and hopefully channel point redemptions)? If not, how can I allow my bot user to read the channel point redemptions using the pubsub_topic?
The best advice here is to create the loop on your own server.
Second off, this generates an implicit oAuth token, which when it dies, means you need to manually recreate the token.
If you used “regular” oAuth on a server you control, you’ll get a refresh token which you can use to generate a new token automatically.
This sounds like you logged in as your bot, which means you granted the bots user client ID to read the bot users redemptions.
When you need to login as you.
You need to create a link betwee your application and your broadcaster account
In order to read the broadcaster accounts redemptions
Doesn’t matter who own’s the clientID. (People generally do not have bot accounts own clientID’s, they attach clientID’s to a “real” user for easier managment of applications/clientID’s)
If you take the token and call the validate endpoint
The user_id returned in the result needs to be the broadcasters user_id. I anticipate the token you have will return the bot’s user_id instead. which is your problem.
So essentially, there should be no bot user involved here at all.
TLDR: You need to generate a token for the broadcaster. Owner of the client_id is irrelevant.
I got to the page where twitch asked me if I wanted to grant my bot’s user the permission to access the channel points on my broadcaster account (or I again don’t understand )
I will look into this again and skip my bot user for the time being and use an app connected to my broadcaster account.