Examples of authenticating in Python with requests instead of curl

Does anyone have an example of the authentication process in Python using the requests module rather than curl? I’m having trouble. I’m relatively new to coding so I might be making a simple mistake.

I’m able to get a 200 Response but I’m not getting the clips:edit scope

class TwitchBot():

def __init__(self):
    self.headers = {
        'client_id': config.twitch_id,
        'redirect_uri': 'http://localhost',
        'response_type': 'token',
        'scope': 'clips:edit'

def clips(self):
    url = 'https://id.twitch.tv/oauth2/authorize'
    response = requests.get(url, params=self.headers)


Step 1 of an oAuth loop is to Redirect a user visiting your website to Twitch.

NOT a cURL/Requests HTTP get.

1) Send the user you want to authenticate to Twitch. Then, an authorization page will ask the user to sign up or log into Twitch and allow the user to choose whether to authorize your application/identity system.

1 Like

Would I take these same steps if I’m just executing a script locally in a text editor rather than a website?

oAuth requires redirecting a user to Twitch for them to authenticate/allow access to their account.

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