Barry, there seems to be a fundamental misunderstanding here. I created a user account for use by Python code to connect to Twitch and get a user ID. The user ID is required by the webhook code to subscribe to follower notifications:
def subscribe(self):
headers = {"Client-ID": self.client_id}
data = {
"hub.mode": "subscribe",
"hub.topic": f"{self.twitch_api_base}/users/follows?first=1&to_id={self.user_id}",
"hub.callback": self.public_uri,
"hub.lease_seconds": str(24 * 60 * 60)
}
result = requests.post(self.webhooks_url, json=data, headers=headers)
if result.status_code == requests.codes.accepted:
self.logger.debug("Our subscription request was accepted by Twitch")
else:
self.logger.debug("Failed to subscribe to follower notifications")
self.logger.debug(f"result.status_code = {result.status_code}")
self.logger.debug(f"result.text = {result.text}")
The problem I am having, is that the user account can no longer get the user ID because of the new requirement to get an OAuth token. Is there some other way to programmatically get the user ID of a Twitch user? If so, I have not been able to find it.
Why not just manually get the user ID, you are probably wondering? Because then it isn’t automated, and the code cannot easily be shared and reused.