link = 'https://api.twitch.tv/helix/users?login=thekill_996'
accept = 'application/vnd.twitchtv.v5+json'
client_id = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
async with aiohttp.ClientSession() as session:
async with session.get(link, headers={'Client-ID': client_id, 'Accept': accept}) as r:
print(r)
You’re not sending an Authorization header with an OAuth token, as specified by the new requirements announced months ago that recently went live.
Also, unrelated to the issue, you’re sending the Accept: application/vnd.twitchtv.v5+json header, which is completely pointless as that’s only for Kraken, and doesn’t do anything on Helix.
a HTTP 401 like what you got from specifying no token at all.
First you need to determine if you need a token that represents a user, or just a server ot server token that lets you fetch public data, give you are calling a user by login you probably need an app access token, that is documented here
Make a POST request, get a token, back maintain that token (it expires every 60 days or so), use that token with your requests to the Twitch API
The requestes I use to do to Twitch API are https://api.twitch.tv/helix/users?login= https://api.twitch.tv/kraken/streams/ https://api.twitch.tv/kraken/streams/?channel=
Perfect I’ll handle them requesting a new token
Gotcha, thanks
I’ve also discovered that I need a client_secret where should i pick it? Never used before…
So this endpoint no longer works without OAth? When was this change made? It used to only require a client id. Why does it now require OAth? That makes it pretty annoying for application developers to use this endpoint…