Getting a user name by access token with the new API

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.

You need to include a header with your request

https://dev.twitch.tv/docs/v5/guides/migration#default-api-version

Specifically

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

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.

:slight_smile: No problem

was about to follow up with this

as a fetch example that works

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.