Getting Users Email

Hi,

I’m a bit confused by the documentation, but if I understood correct, there is no way for an extension to get access to the user’s email address?
We are using the requestIdShare method, but with the non opaque user Id, we can’t access the user’s email.

Is there a way to do that with an extension, or only application can use the Twitch API ?

A users email address is private information, so you have to explicitly ask them to grant your app that permission (extensions are apps too).

You would need to send them through the OAuth process https://dev.twitch.tv/docs/authentication and request the user:read:email scope, which will give you an access token which you can use with the Get Users endpoint to retrieve their email address.

Personally I don’t in my extension

Instead I use a form input text field to ask the user their preference

As most users will ask you to use a different email address to the one attached to their Twitch Account. Or don’t want to grant elevated permissions.

It’s also a little nicer as a) you don’t have the second authentication loop and b) you can tell the user at point of data input how you intend to use the data (great for GDPR)

Thank you Barry.

We are thinking of doing the same, but we were skeptical if this violates any of the TOS for Extensions.
But since you say you are doing this, then I guess it doesn’t violate them :slight_smile:

Hello Dist,

I’m a bit confused as the documentation states you need to register your App in order to use the API.
We have created the extension, does that mean we also need to create an App to use the API ?

You can ask the user for whatever information you want.

GDPR/other regional privacy laws/guidelines apply

So Twitch doesn’t have a specific TOS on not doing it.

An extension is also an App, it provides the same ClientID/secret that you would need to talk to the API

(Under Extension Settings top right)

So you don’t need an Extension and an App as an Extension is also an App

Ok, I thought that you needed to declare the scopes on the App Level.
Obviously this is on the API and not in the App Config.

Clear now
Thank you Barry

Scopes are on a “when I send the user round the oAuth flow” level. So yeah more flexible than App level

1 Like