Hello, I try to update the game and status from a channel with Python.
I create a OAuthtoken with the scope “channel_editor” and then I send a PUT request to https://api.twitch.tv/kraken/channels/<my_channel_id>
I dont know I, use the following URL https://id.twitch.tv/oauth2/token for a request and I use the attributs client_id, client_secret, grant_type & scope.
What grant type are you using? If it’s client_credentials then that’ll get you an App Access Token, something which wont provide access to any endpoints requiring User authorization regardless of what scopes you may try to put on it.
The reason App tokens can’t work is because they’re not associated with any user, so they have no special permissions attached to them. You need to actually send a user through the Auth flow so that they explicitly grant the app permission to access the scopes you’ve asked for.
If this is just something for your own use, what you can do is use the Auth Code flow, go to the URL on Twitch, and when you accept the scopes you’ll be redirected to localhost (which will just 404 if you’re not running a server) but you can still copy the code that is in the URL bar of your browser.
With that code you can continue the rest of the auth process where you exchange that code for a User Access Token and a Refresh Token.
That’s because you’ve put the redirect URI to https:/twitch.tv, which makes no sense. The redirect URI is where Twitch will send your browser after you accept or decline connecting your Twitch account to the app.
You’re getting a redirect mismatch because that redirect URI must match what you’ve set for your app in your TwitchDev console. If you’re just doing this locally, and want to do it as I’ve mentioned, just set your redirect URL in both the URL you’re going to, and in your app settings, as http://localhost/
Okay, I changed the redirect URL to http://localhost and tried it again. https://id.twitch.tv/oauth2/authorize?client_id=<my_client_id>&redirect_uri=http://localhost/&response_type=code&scope=channel_editor
I get to this page:
Du bist dabei, Twitch zu verlassen.
Twitch hat keine Kontrolle über den Inhalt und die Sicherheit von http://localhost.
Continue
You are about to leave Twitch.
Twitch has no control over the content and security of http: // localhost.
Continue
When I clicked “Continue” I came to a page where again the following error;