User stream key

Ive recived the auth token, the request i send is:
return await axios.get(“https://api.twitch.tv/helix/streams/key”,

{
                headers: {
                    'Authorization': `Bearer ${Authorization}`,
                    'Client-Id': client_id
                }
            }
        )

and i get error 400,have i missed somethind that i need to add? also i saw i read that maybe its realated to channel:read:stream_key where i didnt understand where do i add this

Whats the body message?

The HTTP code is half the information

This is a scope which is added to the URL that users click on to provide permission for your CleintID to read/write data on the users behalf.

Scopes are touched on here Twitch Access Token Scopes | Twitch Developers
And how to construct the URL to auth is here https://dev.twitch.tv/docs/authentication/getting-tokens-oauth#authorization-code-grant-flow

do you mean this, if so where do i add this:
https://id.twitch.tv/oauth2/authorize?client_id=${CLIENT_ID}&redirect_uri=${redirectUrl}&response_type=code&scope=openid+user_read
and the body of the message:
Object {
“error”: “Bad Request”,
“message”: “Missing required parameter "broadcaster_id"”,
“status”: 400,
}

Yes, here you have only asked for the scopes

  • openid
  • user_read

user_read is a “dead” scope and no longer documented for use

You didn’t include the broadcaster_id in the query string parameters

So you did https://api.twitch.tv/helix/streams/key
Instead of https://api.twitch.tv/helix/streams/key?broadcaster_id=xxxxx

where xxxxx is the ID of the caster you wish to get the stream key of

https://id.twitch.tv/oauth2/authorize?client_id=${CLIENT_ID}&redirect_uri=${redirectUrl}&response_type=code&scope=openid+user_read,
like this?

No like this

https://id.twitch.tv/oauth2/authorize?client_id=${CLIENT_ID}&redirect_uri=${redirectUrl}&response_type=code&scope=channel:read:stream_key

Its

https://api.twitch.tv/helix/streams/key?broadcaster_id=foo

Substitute foo for the userID

1 Like

ok now it works thank you!!

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