Skip to content

Commit

Permalink
Upgrade to Facebook Graph API 5.0.
Browse files Browse the repository at this point in the history
  • Loading branch information
zyro committed Dec 9, 2019
1 parent 1d2b9c9 commit 41cde12
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions social/social.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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
}
Expand Down

0 comments on commit 41cde12

Please sign in to comment.