Error 403: You don’t have permission to complete the operation or access the resource.
1. Invalid Access Token
The access tokens may be invalidated, if your application requests another token, your application is suspended, or the user de-authorizes your application. (Ex. You request 2 consecutive chat_login tokens, the first will be invalidated.)
You can check if a token is invalid by making a request to Twitch’s API Endpoint, GET /
- Get top level links object and authorization status, with the token you’re testing in a header.
GET /
Basic information about the API and authentication status. If you are authenticated, the response includes the status of your token and links to other related resources.
Example Request
curl -H 'Accept: application/vnd.twitchtv.v3+json' -H 'Authorization: OAuth <access_token>' \
-X GET https://api.twitch.tv/kraken
Example Response
{
"token": {
"authorization": {
"scopes": ["user_read", "channel_read", "channel_commercial", "user_read"],
"created_at": "2015-11-12T06:39:44Z",
"updated_at": "2015-11-12T07:21:20Z"
},
"user_name": "test",
"valid": true
},
"_links": {
"channel": "https://api.twitch.tv/kraken/channel",
"users": "https://api.twitch.tv/kraken/users/test",
"user": "https://api.twitch.tv/kraken/user",
"channels": "https://api.twitch.tv/kraken/channels/test",
"chat": "https://api.twitch.tv/kraken/chat/test",
"streams": "https://api.twitch.tv/kraken/streams",
"ingests":"https://api.twitch.tv/kraken/ingests",
"teams": "https://api.twitch.tv/kraken/teams",
"search": "https://api.twitch.tv/kraken/search"
}
}
2. Authentication Scope requirements.
You request access to this information using the channel_editor
scope parameter, which your app must include in its authentication request.
#3. Update channel’s status or game.
Authenticated, required scope: channel_editor
Parameters
status
| optional | string | Channel’s title.
game
| optional | string | Game category to be classified as.
delay
| optional | string | Channel delay in seconds. Requires the channel owner’s OAuth token.
Form-encoded or JSON parameters specifying the properties to change. These should be under a channel
object:
{
"channel": {
"status": "twitch n chill?",
"game": "CS:GO",
"delay": 60
}
}
Example Request
curl -H 'Accept: application/vnd.twitchtv.v3+json' -H 'Authorization: OAuth <access_token>' \
-d "channel[status]=twitch+n+chill?&channel[game]=CS:GO&channel[delay]=60" \
-X PUT https://api.twitch.tv/kraken/channels/test
Example Response
{
"mature": false,
"status": "twitch n chill?",
"broadcaster_language": "en",
"display_name": "test",
"game": "CS:GO",
"delay": 60,
"language": "en",
"_id": 12345,
"name": "test",
"created_at": "2007-05-22T10:39:54Z",
"updated_at": "2015-02-12T04:15:49Z",
"logo": "",
"banner": "",
"video_banner": "",
"background": null,
"profile_banner": "",
"profile_banner_background_color": "null",
"partner": true,
"url": "http://www.twitch.tv/test",
"views": 10000000,
"followers": 10000000,
"_links": {
"self": "https://api.twitch.tv/kraken/channels/test",
"follows": "https://api.twitch.tv/kraken/channels/test/follows",
"commercial": "https://api.twitch.tv/kraken/channels/test/commercial",
"stream_key": "https://api.twitch.tv/kraken/channels/test/stream_key",
"chat": "https://api.twitch.tv/kraken/chat/test",
"features": "https://api.twitch.tv/kraken/channels/test/features",
"subscriptions": "https://api.twitch.tv/kraken/channels/test/subscriptions",
"editors": "https://api.twitch.tv/kraken/channels/test/editors",
"teams": "https://api.twitch.tv/kraken/channels/test/teams",
"videos": "https://api.twitch.tv/kraken/channels/test/videos"
}
}