Get Stream Key with Python

If you refer to the documentation

It’ll describe the required authentication:

Authentication

  • User OAuth token
  • Required scope: channel:read:stream_key

This means you’ll need to generate a user access token, with the scope channel:read:stream_key

Either using:

Both flows will require a webpage that redirects the user to Twitch to accept or decline the link.

The first (implicit) gives youi a token good for around 60 days
The second returns a token good for around 4 hours, but comes with a refresh token that you can use to get a new access token.

When you have a token then you can call the Get Stream Key API and fetch the user stream key.

So you’ll need

  • to create something that can process the fetching of an access token.
  • create something to store the access token (and refresh token)
  • use that refresh token as needed to get a new access token
    THEN you’ll be able to write some code to then actually go get the access token.
1 Like