From e633188b986e86e2d97e1ca9759b43aa1111fb94 Mon Sep 17 00:00:00 2001 From: Pat Lackemacher Date: Fri, 20 Jan 2017 15:34:31 -0500 Subject: [PATCH] =?UTF-8?q?Use=20Twitch=E2=80=99s=20V5=20API=20when=20gett?= =?UTF-8?q?ing=20user=E2=80=99s=20information?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/ueberauth/strategy/twitchtv.ex | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/lib/ueberauth/strategy/twitchtv.ex b/lib/ueberauth/strategy/twitchtv.ex index f499898..cfda4d7 100644 --- a/lib/ueberauth/strategy/twitchtv.ex +++ b/lib/ueberauth/strategy/twitchtv.ex @@ -176,11 +176,14 @@ defmodule Ueberauth.Strategy.TwitchTv do Stores the raw information (including the token) obtained from the Twitch Tv callback. """ def extra(conn) do + user = conn.private.twitch_tv_user + %Extra { raw_info: %{ token: conn.private.twitch_tv_token, - user: conn.private.twitch_tv_user, - is_partnered: conn.private.twitch_tv_user["partnered"] + user: user, + is_partnered: user["partnered"], + email_verified: user["email_verified"] } } end @@ -188,7 +191,7 @@ defmodule Ueberauth.Strategy.TwitchTv do defp fetch_user(conn, token) do conn = put_private(conn, :twitch_tv_token, token) path = "https://api.twitch.tv/kraken/user" - headers = [Authorization: "OAuth #{token.access_token}"] + headers = [Authorization: "OAuth #{token.access_token}", Accept: "application/vnd.twitchtv.v5+json"] resp = OAuth2.AccessToken.get(token, path, headers) case resp do