Getting a user name by access token with the new API


#1

Hello.
I just got back to the development of my twitch extension and I’ve noticed that the API was updated.

Previously I was getting the user name by calling the following url along with an access token:
https://api.twitch.tv/kraken?oauth_token={sometokenhere}
Unfortunately now the response is:
{"error":"Gone","status":410,"message":"It's time to kick ass and serve v3... and I'm all outta v3. See https://dev.twitch.tv/docs"}

I can’t seem to find the same thing in the new API. Is there no way to get the basic user data by using the access token anymore ?

Thanks in advance.


#2

You need to include a header with your request

Specifically

'Accept: application/vnd.twitchtv.v5+json'

#3

Oh damn I can’t believe that I’ve missed that. I’m using that header for all of my other requests but not for this one. Thanks Barry.


#4

:slight_smile: No problem

was about to follow up with this

as a fetch example that works


#5

Use that endpoint. If you don’t use the id or login params it’ll instead return the data of the user associated with the token you’re providing.