From 41cde12aa9710df00ed52f6ce68bff11f420b94b Mon Sep 17 00:00:00 2001 From: Andrei Mihu Date: Mon, 9 Dec 2019 13:50:49 +0000 Subject: [PATCH] Upgrade to Facebook Graph API 5.0. --- CHANGELOG.md | 1 + social/social.go | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7cfbbd3a4e..38fb7596e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr - Faster validation of JSON object input payloads. - Update IAP validation example for Android Publisher v3 API. - Relayed multiplayer matches allow echoing messages back to sender if they're in the filter list. +- Upgrade Facebook authentication to use version 5.0 of the Facebook Graph API. ### Fixed - Correctly read pagination cursor in notification listings. diff --git a/social/social.go b/social/social.go index e0cfd84798..336a4bd561 100644 --- a/social/social.go +++ b/social/social.go @@ -160,7 +160,7 @@ dAUK75fDiSKxH3fzvc1D1PFMqT+1i4SvZPLQFCE= // GetFacebookProfile retrieves the user's Facebook Profile given the accessToken func (c *Client) GetFacebookProfile(ctx context.Context, accessToken string) (*FacebookProfile, error) { - path := "https://graph.facebook.com/v2.12/me?access_token=" + url.QueryEscape(accessToken) + + path := "https://graph.facebook.com/v5.0/me?access_token=" + url.QueryEscape(accessToken) + "&fields=" + url.QueryEscape("name,email,gender,locale,timezone") var profile FacebookProfile err := c.request(ctx, "facebook profile", path, nil, &profile) @@ -177,7 +177,7 @@ func (c *Client) GetFacebookFriends(ctx context.Context, accessToken string) ([] after := "" for { // In FB Graph API 2.0+ this only returns friends that also use the same app. - path := "https://graph.facebook.com/v2.12/me/friends?access_token=" + url.QueryEscape(accessToken) + path := "https://graph.facebook.com/v5.0/me/friends?access_token=" + url.QueryEscape(accessToken) if after != "" { path += "&after=" + after }