tsifrer / python-twitch-client

Python wrapper for Twitch API

Home Page:http://python-twitch-client.readthedocs.io/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add OAuth Token Fetch

BoraxTheClean opened this issue · comments

Piggybacking off of #12

Issue

Since the Helix API requires OAuth , I propose this library grow the capability of fetching an OAuth token given a client_id and client_secret.

Proposed Behavior

If TwitchHelix is initialized without an OAuth token and with both a client_id and client_secret, a request is made to https://id.twitch.tv/oauth2/token to fetch a valid OAuth token.

If the TwitchHelix is initialized without an OAuth token and without either a client_id/client_secret a Credential exception is raised.

I'll Build It

If the maintainer blesses this as a valid new feature to add, I will gladly open a PR with this change for review.

I'd gladly accept the PR.
One good thing to add to this would be to somehow be able to configure which scopes you need with the OAuth token (if that's possible to do)

@tsifrer When you get a chance can you review #67 for this issue?