Get Channel Followers usernames

Hello,

I have a website where I display the users who follows my Twitch channel,

It was working perfectly, but now I can’t get the users names anymore,

I used to do a request on https://api.twitch.tv/helix/users/follows with to_id parameter, but now I see on the Get Channel Followers API reference page, the endpoint has changed so I changed my code but I can’t get usernames, only the total : {"total":8,"data":[],"pagination":{}}

Code :

`

url: "https://api.twitch.tv/helix/channels/followers",
method: "GET",
headers: {
  "Client-ID": process.env.TWITCH_CLIENT_ID,
  Authorization: "Bearer " + accessToken,
},
qs: {
  broadcaster_id: process.env.TWITCH_BROADCASTER_ID,
},

};

`

Get Channel Followers requires

  • a user access token
  • With the scope moderator:read:followers
  • And the user access token belongs to a moderator or better for the channel specified in broadcaster_id

Your error suggests you use an app acess token or a user token without sufficent permissions

I’m using this token to do the request, it used to work well… :

`

const oAuthClientCredentialsFlow = {
url: “https://id.twitch.tv/oauth2/token”,
json: true,
body: {
client_id: process.env.TWITCH_CLIENT_ID,
client_secret: process.env.TWITCH_CLIENT_SECRET,
grant_type: “client_credentials”,
scope:
“user:read:email moderation:read moderator:read:followers user:read:follows channel:read:stream_key”,
},
};
`

That is an app access token, which for Twitch adding scopes does nothing

App Access Token is also known as Client credentials, so you have the wrong token type

Normally you will need a code flow token - Getting OAuth Access Tokens | Twitch Developers which is valid for around four hours then you would use the refresh token to get a new token.

Additionally you might want to consider using EventSub then Twitch will call you with a new follower and just store that in your database and reference the database table instead.

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