Hello guys, I’m trying the twitch API with python i write this code:
from twitch import TwitchClient
#twitch api
client = TwitchClient(CLIENT, OAUTH2)
channel = client.channels.get()
pretty easy, but when i run it in terminal i get this:
requests.exceptions.HTTPError: 401 Client Error: Unauthorized for url: https://api.twitch.tv/kraken/channel
thanks in advance , thomas
to be honest, that’s the first time i see this error. however i’m not much of an expert anyway.
interested in seeing a solution, update if you find one. thanks
That would suggest the oAuth token is invalid not a user token, and no channel can be returned, as it’s not a user token but an app access token.
Is your oAuth still valid and of the correct type?
I use my account oAuth token and the id of registrated applicazioni, Is right?
How did you obtain the oAuth token?
Did you use a third party tool or your own oAuth?
Is it of Type User and not app access token?
I use the Twitch chat oAuth password generator from twitchapps.com/tmi/ i think ill nerd the app access token right? Where could i find it?
No you can’t use an app access token with the Kraken Channels endpoint as when you don’t declare a channel ID it returns the channel for that token, And a App Access Token has no channel.
This suggests your token has expired. hence the 401
The generate advice is to migrate to Helix if you can rather than using V5.
Cool i’ll try thanks Barry !