diff --git a/CHANGELOG.md b/CHANGELOG.md index 2f6c9218f524c3dcf47b39596563cbc601aaa9c8..ae70952dba4474eabedb551f746e96f255b98fb1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,8 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr - Make metrics prefix configurable, default to fixed value. - Build with Go 1.15.5 release. - Skip logging Lua errors raised by explicit runtime calls to the `error({msg, code})` built-in. +- Update to Facebook Graph API v9.0. +- Facebook authentication no longer requires access to gender, locale, and timezone data. ### Fixed - Better handling of SSL connections in development configurations. diff --git a/social/social.go b/social/social.go index 15b7b6e9c2b98b6248649a287f49ce6a669f746e..59fb5dfe82086b9026dac54935e3cb3f38662a00 100644 --- a/social/social.go +++ b/social/social.go @@ -78,12 +78,9 @@ type AppleProfile struct { // FacebookProfile is an abbreviated version of a Facebook profile. type FacebookProfile struct { - ID string `json:"id"` - Name string `json:"name"` - Email string `json:"email"` - Gender string `json:"gender"` - Locale string `json:"locale"` - Timezone float64 `json:"timezone"` + ID string `json:"id"` + Name string `json:"name"` + Email string `json:"email"` } type facebookPagingCursors struct { @@ -194,8 +191,8 @@ dAUK75fDiSKxH3fzvc1D1PFMqT+1i4SvZPLQFCE= func (c *Client) GetFacebookProfile(ctx context.Context, accessToken string) (*FacebookProfile, error) { c.logger.Debug("Getting Facebook profile", zap.String("token", accessToken)) - path := "https://graph.facebook.com/v5.0/me?access_token=" + url.QueryEscape(accessToken) + - "&fields=" + url.QueryEscape("name,email,gender,locale,timezone") + path := "https://graph.facebook.com/v9.0/me?access_token=" + url.QueryEscape(accessToken) + + "&fields=" + url.QueryEscape("name,email") var profile FacebookProfile err := c.request(ctx, "facebook profile", path, nil, &profile) if err != nil { @@ -213,7 +210,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/v5.0/me/friends?access_token=" + url.QueryEscape(accessToken) + path := "https://graph.facebook.com/v9.0/me/friends?access_token=" + url.QueryEscape(accessToken) if after != "" { path += "&after=" + after }