So it’s probably because I’m new to Twitch’s API, but I have done work with other, non OAuth, APIs before. So I know how to curl and add headers and such. But this baffles me…
This is for a bot that is already registered.
So I send a request to
and I get back what looks to be (from the file content) the twitch homepage. I get nothing in terms of a authorization code to put into the header of the next request (under Authorization).
What am I missing here? Can someone give me a step by step on how to get this Authorization key from Twitch so I can send commands to it?
The first step of oAuth is to redirect/send the user to that URL in a browser in order for the logged in Twitch user to allow the link between your application and that Twitch account.
Then after allowing the link, they are redirected to your redirect URL with a ?code
?code is then exchanged for a token to use with the API
This is a “one page” PHP example describing the workflow https://github.com/BarryCarlyon/twitch_misc/blob/main/authentication/user_access_generator/php/index.php
Step 1) Redirect the user to Twitch
Step 2) They accept (or decline) access to the ClientID to their account
Step 3) they come back to your site with a
?code or error message
Step 4) if code exhcnage the code for a token (and refresh token)
And that is User oAuth in a nutshell
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.