Skip to content

Instantly share code, notes, and snippets.

Last active December 17, 2019 14:47
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Authentication for Twitch API
#Client ID: --***---
#Client Secret: ---***---
#Client ID and Client Secret are sensititve and you should not share them
client_id= <yourclientid>
client_secret= <yourclientsecret>
#Request for the access code using requests library
#I have chosen this method of authentication with my goal in mind
access_code =''+str(client_id)+'&client_secret='+str(client_secret)+'&grant_type=client_credentials')
#access token response is a JSON-encoded app access token
access_token = json.loads(access_code.text)
access_token = access_token['access_token']
#Sample response is
"access_token": "prau3ol6mg5glgek8m89ec2s9q5i3i",
"refresh_token": "",
"expires_in": 3600,
"scope": [],
"token_type": "bearer"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment