Connecting Twitch OAuth requests with a user account?

Hello everyone,
I have a Twitch-related web app which currently has a traditional user account framework using email addresses and passwords. I’m looking to integrate Twitch OAuth to retrieve followed and subscribed streamers, but while I’m at it I’d really like for users to just be able to log in with their Twitch accounts instead of having to remember a separate email and password. I’d base it entirely on the Twitch API and OAuth system, but there are certain other things I’d like to store - including their preferred order of streamers, settings related to default stream volumes, etc.

I’ve started playing around with the OAuth documentation at https://dev.twitch.tv/docs/v5/guides/authentication/ and I’ve successfully worked through the whole thing, getting an authorization token. I understand this is mainly to make authorized requests to the Twitch API. But I’ve noticed this token is different every time (purposeful I’m sure). I was hoping the request would return something static pertaining to the user so I could connect a request with a user account on my system.

I’m not sure if I’m missing something, but is there some way I can make a 1:1 connection between a user’s Twitch account and their account in my app, for the purposes of logging in?

You could use the user ID as the static identifier to the user. https://dev.twitch.tv/docs/v5/guides/using-the-twitch-api/ shows the response to the https://api.twitch.tv/kraken/user endpoint with a user name and user id in v5. In v3 it only had the user name last I checked. You could then tie their user id in your database with a secure cookie on their browser representing they logged in with twitch.

1 Like

That’s a great idea. Thank you! I’ll look into that.

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