Access Token query

Apologies for the possibly daft question…
On my site I want to offer a certain function to streamers listed on my site however I want to be sure the feature and the information given to my site from them is from the actual user and not a fake person.

So my question is this…
They will need to provide this info via their registered twitch email address
Now when my app queries the users endpoint obviously I can’t see their email address
So how would they provide me with an access token for their account ?
So that when I have the token I can then verify the email address matches

I’m hoping this is going to be a very simple process for them

oAuth: Getting OAuth Access Tokens | Twitch Developers

Uou can if you call the “Get users” endpoint with a user token that has the user:read:email scope (do not specify a user id or login)

When you call Get User

  • with a token
  • without a id in the params
  • without a login in the params

Then the Get Users API returns a object representing the user that the token belongs to

Docs: Reference | Twitch Developers
Implict auth example demonstrating that: Twitch Implicit Auth Example

But userID from the Get Users endpoint (getting a userID for a token as noted above) should be sufficent, rather than via email address. So in theory you do not need to do it via email address. Additionally you might find that streamers use a different email address for their account than you use to match them if you are using their “public conatct meail”. So userID matching via userID from validate or get users will suffice.

Alternatively the userID is returned from the validate endpoint when calling with a user token you got from an oAuth login flow Authentication | Twitch Developers

Ahh thank you Barry…
I’ve been doing things a bit backwards then …
That makes perfect sense and nice and simple…
Thanks again for your fast & very helpful response :slight_smile:

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