loginsrv

Unnamed repository; edit this file 'description' to name the repository.
git clone git@jamesshield.xyz:repos/loginsrv.git
Log | Files | Refs | README | LICENSE

commit b03ac36249cf79a54d758ef6ae2b137297095d30
parent 9c3bf63cb81d05770c0690c216045bfb168a1407
Author: Sebastian Mancke <sebastian.mancke@snabble.io>
Date:   Thu,  3 Jan 2019 21:41:42 +0100

Merge pull request #112 from tarent/facebook-default-scope

Facebook default scope
Diffstat:
MREADME.md | 7++-----
Moauth2/facebook.go | 7++++---
2 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/README.md b/README.md @@ -301,9 +301,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 * Gitlab An OAuth provider supports the following parameters: @@ -324,9 +324,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`. diff --git a/oauth2/facebook.go b/oauth2/facebook.go @@ -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{}