Helix endpoint, get game name by game ID

So I’ve searched through this forum quite a lot and I am at my wits end. I’m simply trying to get a the name of a game after retrieving it’s id. So I’ve read, that the API call:
https://api.twitch.tv/helix/games?id=
will return the game name in the body. This however doesn’t really work because it tells me, that the oauth and the clientID don’t match. I don’t know why, because every other call works just fine.
I try to get the game name via request:

return request({
baseUrl: ‘https://api.twitch.tv/helix/games?id=’ + gameid,
url: ‘channel’,
method: ‘GET’,
headers: {
Accept: ‘application/vnd.twitchtv.v5+json’,
Authorization: 'Bearer ’ + access_token,
‘Client-ID’: clientID
},
json: true
},
(err, { statusCode }, body) => {
if(err)
console.log(err);
else if(statusCode !== 200){
console.log({ statusCode, body });
}
else{
/* do stuff with the game name */
}
});

What am I doing wrong here? :frowning:

Don’t need the accept header with helix

With Helix you need to use a ClientID and a Token generated for that ClientID, you are calling helix where the token is generated using a different ClientID

Thanks a lot :slight_smile: this helped.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.