@@ -3,14 +3,15 @@ package oauth
|
||||
import (
|
||||
"github.com/authorizerdev/authorizer/server/constants"
|
||||
"golang.org/x/oauth2"
|
||||
facebookOAuth2 "golang.org/x/oauth2/facebook"
|
||||
githubOAuth2 "golang.org/x/oauth2/github"
|
||||
googleOAuth2 "golang.org/x/oauth2/google"
|
||||
)
|
||||
|
||||
type OAuthProviders struct {
|
||||
GoogleConfig *oauth2.Config
|
||||
GithubConfig *oauth2.Config
|
||||
// FacebookConfig *oauth2.Config
|
||||
GoogleConfig *oauth2.Config
|
||||
GithubConfig *oauth2.Config
|
||||
FacebookConfig *oauth2.Config
|
||||
}
|
||||
|
||||
var OAuthProvider OAuthProviders
|
||||
@@ -33,12 +34,13 @@ func InitOAuth() {
|
||||
Endpoint: githubOAuth2.Endpoint,
|
||||
}
|
||||
}
|
||||
// if constants.FACEBOOK_CLIENT_ID != "" && constants.FACEBOOK_CLIENT_SECRET != "" {
|
||||
// OAuthProvider.FacebookConfig = &oauth2.Config{
|
||||
// ClientID: constants.FACEBOOK_CLIENT_ID,
|
||||
// ClientSecret: constants.FACEBOOK_CLIENT_SECRET,
|
||||
// RedirectURL: "/oauth_callback/facebook/",
|
||||
// Endpoint: facebookOAuth2.Endpoint,
|
||||
// }
|
||||
// }
|
||||
if constants.FACEBOOK_CLIENT_ID != "" && constants.FACEBOOK_CLIENT_SECRET != "" {
|
||||
OAuthProvider.FacebookConfig = &oauth2.Config{
|
||||
ClientID: constants.FACEBOOK_CLIENT_ID,
|
||||
ClientSecret: constants.FACEBOOK_CLIENT_SECRET,
|
||||
RedirectURL: constants.AUTHORIZER_URL + "/oauth_callback/facebook",
|
||||
Endpoint: facebookOAuth2.Endpoint,
|
||||
Scopes: []string{"public_profile", "email"},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user