Twitch.py in discord.py

Change

response = requests.post("https://id.twitch.tv/oauth2/token", params=params)
access_token = response.json()["access_token"]
return access_token

to

response = requests.post("https://id.twitch.tv/oauth2/token", params=params)
full_response = response.json()
print(full_response )

Which will log out the full_response that’ll provide the error message if any

Your code doesn’t check if the response code was 200 OK and/or if an access token was acturally returned or not from the API call