Commit 41cde12a authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Upgrade to Facebook Graph API 5.0.

parent 1d2b9c98
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -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.
+2 −2
Original line number Diff line number Diff line
@@ -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
		}