# OAuth2Strategy doesnt provide email in user profile

**URL:** <https://discuss.dev.twitch.com/t/oauth2strategy-doesnt-provide-email-in-user-profile/22698>\
**Category:** API\
**Created:** [October 3, 2019, 1:31pm UTC](https://discuss.dev.twitch.com/t/oauth2strategy-doesnt-provide-email-in-user-profile/22698 "2019-10-03T13:31:52Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![BarryCarlyon](https://d3ovvz0v2ajtpu.cloudfront.net/user_avatar/discuss.dev.twitch.com/barrycarlyon/32/253_2.png) [@BarryCarlyon](https://discuss.dev.twitch.com/u/BarryCarlyon)\
**Post date:** [October 4, 2019, 2:37pm UTC](https://discuss.dev.twitch.com/t/oauth2strategy-doesnt-provide-email-in-user-profile/22698/5 "2019-10-04T14:37:20Z")

</div>

> [@WLG3R](#):
>
> I just did a test. The [https://id.twitch.tv/oauth2/userinfo](https://id.twitch.tv/oauth2/userinfo) endpoint does NOT show email address. You will need to call to the Kraken or Helix API with the correct scope to get the email. So even if you make an updated passport strategy, it won’t pull email.

**THIS INFORMATION IS WRONG**

It will if you make the correct claims under openID auth

> [@RealMoris](#):
>
> But in the example they specify scope user\_read and this is twitch API v5.  
> So I tried to set scope to user:read:email and it deliveres then email address.

You don’t need to do that. Please refer to the claims section of OIDC

> **[Using OIDC to get OAuth Access Tokens](https://dev.twitch.tv/docs/authentication/getting-tokens-oidc/)**
>
> Using OIDC to get OAuth Access Tokens

I construct the following URL to redirect people to:

```
    var url = oidc_data.authorization_endpoint
        + '?client_id=' + client
        + '&redirect_uri=' + redirect
        + '&response_type=code'
        + '&force_verify=true'
        + '&scope=openid'
        + '&state=' + encodeURIComponent(req.session.state)
        + '&claims=' + JSON.stringify({
            userinfo: {
                email:null,
                email_verified:null,
                picture:null,
                preferred_username:null
            }
        });

```

Where `oidc_data` is fetched from `https://id.twitch.tv/oauth2/.well-known/openid-configuration`

Making a call to `oidc_data.userinfo_endpoint` I get:

 ![59](https://d2opxh93rbxzdn.cloudfront.net/original/2X/d/dcd32273423efc97c8c2475e6a7e16c0898486ab.png)

---

_[View the full topic](https://discuss.dev.twitch.com/t/oauth2strategy-doesnt-provide-email-in-user-profile/22698)._
