pororia
December 24, 2018, 12:22am
1
I got token about channel_subscriptions.
1.I requested like below.
GET https://api.twitch.tv/kraken/channels/<channel ID>/subscriptions?limit=100
403
And, I met message like below.
{“error”:“Forbidden”,“status”:403,“message”:"Unable to access channel subscribers of "}
What do I must check?
Dist
December 24, 2018, 12:55am
2
Are you sending an Authorization: OAuth <YOUR TOKEN>
header?
Also, is the token with the channel_subscriptions
scope provided by the channel you’re attempting to access the endpoint with?
And you did actually substitute <channel ID>
for the channel ID of the channel you are trying to fetch subscriptions for, and the token has the auth for that channel ID as Dist says
pororia
December 26, 2018, 6:37am
4
Thank you for your answer!
Yes, I sent 'Authorization: OAuth ’ with ‘channel_subscriptions’ scope when requested it.
And if token has problem, I know that see message about ‘Invalid token’.
I already went through processes.
Did you send a token with channel_subscriptions for the channel_id you are requesting the subscribers for
pororia
December 27, 2018, 12:46pm
6
Yes, I sent a token.
Step of code is below.
Step 1:
https://id.twitch.tv/oauth2/authorize?client_id='+config.twitch_getToken.clientID+'&redirect_uri='+config.twitch_getToken.callbackURL+'&response_type=code&scope=channel_subscriptions
Step 2:
https://id.twitch.tv/oauth2/token?client_id=<%=config.clientID%>&client_secret=<%=config.clientSecret%>&code=<%=code_channel_subscriptions%>&grant_type=authorization_code&redirect_uri=<%=config.callbackURL%>
Step 3:
fetch('https://api.twitch.tv/kraken/channels/<%=user.username%>/subscriptions', {
method: 'GET',
headers: new Headers({
'Authorization': 'OAuth ' + data.access_token,
'Client-ID': '<%=config.clientID%>',
'Accept': 'application/vnd.twitchtv.v5+json'
})
}).then(response => response.json()).then(data => {
console.log('get subscriptions === '+JSON.stringify(data));
});
Result:
{“error”:“Forbidden”,“status”:403,“message”:“Unable to access channel subscribers of <channel_id>”}
Step 1:
I’m assuming you are performing a HTTP redirect and redirecting the user to Twitch
Step 3:
This should be UserID not Username
v5 works via ID not name
pororia
December 27, 2018, 1:10pm
8
Yes, I know.
user.username variable is same with channel_id.
My channel url is ‘https://www.twitch.tv/poXXXXX ’.
And, My display name is poXXXXX.
And user.username variable is displayname.
And, I checked it through this below.
fetch(‘https://api.twitch.tv/kraken/channels/ <%=user.username%>’,
Is my opinion correct?
As per
You need to send USERID
not USERNAME
, as you are declaring Twitch API v5
So for me I would send 15185913
not barrycarlyon
As per the example:
curl -H 'Accept: application/vnd.twitchtv.v5+json' \
-H 'Client-ID: uo6dggojyb8d6soh92zknwmi5ej1q2' \
-H 'Authorization: OAuth cfabdegwdoklmawdzdo98xt2fo512y' \
-X GET 'https://api.twitch.tv/kraken/channels/129454141/subscriptions'
pororia
December 27, 2018, 1:24pm
10
Thank you for your answer.
I tested using userid according to your guide.
fetch(‘https://api.twitch.tv/kraken/channels/’+get_userid()+’/subscriptions ’, {
And I met message below.
{“error”:“Bad Request”,“status”:400,“message”:“proXXXXX does not have a subscription program”}
What is this problem?
Dist
December 27, 2018, 1:35pm
11
Much like the error message says, the channel doesn’t have a subscription program. If the channel is not a Partner or Affiliate, it’s not eligible to have subscribers so you can’t get their subscriptions as there isn’t any.
pororia
December 27, 2018, 1:40pm
12
Thank you for your answer.
I understand it.
Once again thank you very much.
Dist:
Much like the error message says, the channel doesn’t have a subscription program. If the channel is not a Partner or Affiliate, it’s not eligible to have subscribers so you can’t get their subscriptions as there isn’t any.
system
Closed
January 26, 2019, 1:40pm
13
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.