Getting a List of channels the user is following

I figured out how to get the token and now I ran into a problem. I’m trying to get a list of channels that a specific user is following. I send this request:
https://api.twitch.tv/kraken?oauth_token=4vr512upv97xdqfnpqa3sqe5o15vyl

and I get back:

{"_links":{"user":"https://api.twitch.tv/kraken/user","channel":"https://api.twitch.tv/kraken/channel","search":"https://api.twitch.tv/kraken/search","streams":"https://api.twitch.tv/kraken/streams/aksynial","ingests":"https://api.twitch.tv/kraken/ingests","teams":"https://api.twitch.tv/kraken/teams","users":"https://api.twitch.tv/kraken/users/aksynial","channels":"https://api.twitch.tv/kraken/channels/aksynial","chat":"https://api.twitch.tv/kraken/chat/aksynial"},"token":{"valid":true,"authorization":{"scopes":["user_read","channel_read","user_follows_edit"],"created_at":"2015-03-03T22:08:48.006088Z","updated_at":"2015-03-03T22:08:48.006088Z"},"user_name":"aksynial"}}

This seems right and I follow the link to “channels” and then “follows” but I end up with:

{"follows":[],"_total":0,"_links":{"self":"https://api.twitch.tv/kraken/channels/aksynial/follows?direction=DESC&limit=25&offset=0","next":"https://api.twitch.tv/kraken/channels/aksynial/follows?direction=DESC&limit=25&offset=25"}}

I’m sure the sure has at least 5 channels they are following so how come it is displaying 0? How would I be able to get a list of followers?

channels/channelname/follows is the endpoint for listing users following the channel ‘channelname’

What you want is:
https://github.com/justintv/Twitch-API/blob/master/v3_resources/follows.md#get-usersuserfollowschannels

Example:

https://api.twitch.tv/kraken/users/aksynial/follows/channels?oauth_token=4vr512upv97xdqfnpqa3sqe5o15vyl

BTW, you just gave everyone who reads this thread the ability to follow/unfollow any channel they want. I recommend invalidating that token by either deauthorizing the client under Twitch or by signing into your application again. You can then visit https://api.twitch.tv/kraken?oauth_token=4vr512upv97xdqfnpqa3sqe5o15vyl again to verify that the token is no longer valid.

1 Like

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