justintv / Twitch-API

A home for details about our API
www.twitch.tv
1.72k stars 381 forks source link

User Endpoint returning null Email #541

Closed romanzipp closed 8 years ago

romanzipp commented 8 years ago

In some cases the https://api.twitch.tv/kraken/user endpoint is returning the Email as null although a valid access_token is transfered. The user_read scope is also present.

When using the same access token with scopes user_read and user_subscriptions

https://api.twitch.tv/kraken/user is still returing null email but https://api.twitch.tv/kraken/users/<user>/subscriptions/<target> is not returning an authorization error.

Here are some example responses:

Valid Email field

{
  "display_name": "User1",
  "_id": 000000,
  "name": "user1",
  "type": "user",
  "bio": null,
  "created_at": "2015-01-06T21:01:19Z",
  "updated_at": "2016-04-27T16:22:18Z",
  "logo": null,
  "_links": {
    "self": "https://api.twitch.tv/kraken/users/user1"
  },
  "email": "THIS-EMAIL@IS.VALID",
  "partnered": false,
  "notifications": {
    "push": true,
    "email": false
  }
}

null Email field

{
  "display_name": "User2",
  "_id": 000000,
  "name": "user2",
  "type": "user",
  "bio": null,
  "created_at": "2015-03-29T12:01:11Z",
  "updated_at": "2016-04-27T16:29:19Z",
  "logo": null,
  "_links": {
    "self": "https://api.twitch.tv/kraken/users/user2"
  },
  "email": null,
  "partnered": false,
  "notifications": {
    "push": true,
    "email": true
  }
}
ghost commented 8 years ago

Has the user you're querying validated their email?

romanzipp commented 8 years ago

I dont't know. Is there a way to find this out?

ghost commented 8 years ago

Presumably if you're requesting OAuth tokens, you should have some form of contact with the user. If not, register a new account and test it?

romanzipp commented 8 years ago

I tested it out in the moment you replied. It seems that it's like you said that the email field is null if the user hasn't verified his email. This should be added to the documentation.

3ventic commented 8 years ago

Pull request #336 addresses this.