Hi all,
When trying to create a new clip, I get this error:
{
error: 'Unauthorized',
status: 401,
message: 'Missing clips:edit scope'
}
Prior to making the post call to https://api.twitch.tv/helix/clips
, I obtained an access_token
with the required scope clips:edit
(I checked it in the token response, where the scope array contained it).
I’m using axios to make requests. Here’s the code I’m using, in case it’s useful:
// client is an axios instance
client.post('https://id.twitch.tv/oauth2/token?client_id=myID&client_secret=mySecret&grant_type=client_credentials&scope=clips:edit')
.then(response => {
console.log(response.data.access_token, response.data.scope) // Token and scopes seem correct
client.defaults.headers.common['Authorization'] = `Bearer ${response.data.access_token}` // Set Auth header for subsequent requests
client.post('https://api.twitch.tv/helix/clips', {
broadcaster_id: 93031467
}).then(response => {
console.log(response.data)
}).catch(err => {
console.log(err) // Here I get the missing scope error
})
})
Thanks!
EDIT: Okay, I think this response works for me. Now I only have to figure out how to get a client access token.
EDIT2: Yes, that was the problem, I followed these steps and got it to work. I hope this is useful for someone as clueless as me