I’m getting an unauthorized error trying to get the data from the streams api:
{'error': 'Unauthorized', 'status': 401, 'message': 'Invalid OAuth token'}
I’ve tried passing both my App Access Token and the Users OAuth token with no success. I’m using the following python code to call the api:
twitch_api_url = 'https://api.twitch.tv/helix/'
def twitch(endpoint, token, **kwargs):
headers = {
'Authorization': 'Bearer %s' % token,
'Client-Id': settings.TWITCH_CLIENT_ID
}
url = twitch_api_url + endpoint
response = requests.get(url, headers=headers, params=kwargs)
return response.text
Whenever i logout it should be getting rid of the old tokens stored in localstorage so the tokens that i’m using should be new and not expired. I’m not sure what i am missing?