I am trying to update my stream title via the Helix API, but my OAuth token is being rejected with a HTTP 401 Unauthorized error saying “incorrect user authorization.”
I created my token with this command:
curl -X POST\
-F 'client_id=[client-id-redacted]'\
-F 'client_secret=[client-secret-redacted]'\
-F 'grant_type=client_credentials'\
-F 'scope=channel:manage:broadcast'\
https://id.twitch.tv/oauth2/token
Which gave me the expected response:
{"access_token":"[token-redacted]","expires_in":4720809,"scope":["channel:manage:broadcast"],"token_type":"bearer"}
Then I used that token in a PATCH request, trying to change my stream title:
curl -X PATCH "https://api.twitch.tv/helix/channels?broadcaster_id=[broadcaster-id-redacted]" \
-H 'Authorization: Bearer [token-redacted]' \
-H 'Client-Id: [client-id-redacted]' \
-H 'Content-Type: application/json' \
-d '{"title":"Test"}'
So far as I understand that is the correct type of OAuth token for changing a stream title.
For the sake of debugging I also tried creating a token using Twitch OAuth Token Generator but it gave me the same HTTP 401 error (which is what should happen, so far as I know).
I’m stuck and don’t know what to do now. Those two methods are the only way I’ve ever created OAuth tokens for use with the Twitch Helix API and this is the first time I’ve gotten this error.
Thank you for any help.