Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add picture field to facebook #150

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions facebook/verify.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@ const facebookAPI = "https://graph.facebook.com/v2.9/"
//
// Note that user ids are unique to each app.
type User struct {
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
ID string `json:"id"`
Name string `json:"name"`
Email string `json:"email"`
Picture struct {
Data struct {
URL string `json:"url"`
} `json:"data"`
} `json:"picture"`
}

// client is a Facebook client for obtaining the current User.
Expand All @@ -36,6 +41,6 @@ func (c *client) Me() (*User, *http.Response, error) {
// Facebook returns JSON as Content-Type text/javascript :(
// Set Accept header to receive proper Content-Type application/json
// so Sling will decode into the struct
resp, err := c.sling.New().Set("Accept", "application/json").Get("me?fields=name,email").ReceiveSuccess(user)
resp, err := c.sling.New().Set("Accept", "application/json").Get("me?fields=name,email,picture").ReceiveSuccess(user)
return user, resp, err
}