Skip to content

Commit

Permalink
set email as facebook default scope
Browse files Browse the repository at this point in the history
  • Loading branch information
smancke committed Jan 2, 2019
1 parent 79221b6 commit 0d57656
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -299,9 +299,9 @@ The OAuth Web Flow (aka 3-legged-OAuth flow) is also supported.
Currently the following OAuth provider is supported:

* GitHub
* Google (see note below)
* Google
* Bitbucket
* Facebook (see note below)
* Facebook

An OAuth provider supports the following parameters:

Expand All @@ -321,9 +321,6 @@ if loginsrv is routed through a reverse proxy, if the headers `X-Forwarded-Host`
$ docker run -p 80:80 tarent/loginsrv -github client_id=xxx,client_secret=yyy
```

### Note for Facebook's OAuth 2
Make sure you ask for the scope `email` when adding your Facebook config option. Otherwise the provider won't be able to fetch the user's email.

## Templating

A custom template can be supplied by the parameter `template`.
Expand Down
7 changes: 4 additions & 3 deletions oauth2/facebook.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ type facebookUser struct {
}

var providerfacebook = Provider{
Name: "facebook",
AuthURL: "https://www.facebook.com/v2.12/dialog/oauth",
TokenURL: "https://graph.facebook.com/v2.12/oauth/access_token",
Name: "facebook",
AuthURL: "https://www.facebook.com/v2.12/dialog/oauth",
TokenURL: "https://graph.facebook.com/v2.12/oauth/access_token",
DefaultScopes: "email",
GetUserInfo: func(token TokenInfo) (model.UserInfo, string, error) {
fu := facebookUser{}

Expand Down

0 comments on commit 0d57656

Please sign in to comment.