add discord auth
This commit is contained in:
parent
1e2da5d396
commit
9eee484338
|
@ -43,6 +43,7 @@ var OAuth2Providers = map[string]OAuth2Provider{
|
|||
"gplus": {Name: "gplus", DisplayName: "Google+", Image: "/img/auth/google_plus.png"},
|
||||
"openidConnect": {Name: "openidConnect", DisplayName: "OpenID Connect", Image: "/img/auth/openid_connect.png"},
|
||||
"twitter": {Name: "twitter", DisplayName: "Twitter", Image: "/img/auth/twitter.png"},
|
||||
"discord": {Name: "discord", DisplayName: "Discord", Image: "/img/auth/discord.png"},
|
||||
}
|
||||
|
||||
// OAuth2DefaultCustomURLMappings contains the map of default URL's for OAuth2 providers that are allowed to have custom urls
|
||||
|
|
|
@ -23,6 +23,7 @@ import (
|
|||
"github.com/markbates/goth/providers/gplus"
|
||||
"github.com/markbates/goth/providers/openidConnect"
|
||||
"github.com/markbates/goth/providers/twitter"
|
||||
"github.com/markbates/goth/providers/discord"
|
||||
"github.com/satori/go.uuid"
|
||||
)
|
||||
|
||||
|
@ -172,6 +173,8 @@ func createProvider(providerName, providerType, clientID, clientSecret, openIDCo
|
|||
}
|
||||
case "twitter":
|
||||
provider = twitter.NewAuthenticate(clientID, clientSecret, callbackURL)
|
||||
case "discord":
|
||||
provider = discord.New(clientID, clientSecret, callbackURL, discord.ScopeIdentify, discord.ScopeEmail),
|
||||
}
|
||||
|
||||
// always set the name if provider is created so we can support multiple setups of 1 provider
|
||||
|
|
|
@ -1458,6 +1458,7 @@ auths.tip.gitlab = Register a new application on https://gitlab.com/profile/appl
|
|||
auths.tip.google_plus = Obtain OAuth2 client credentials from the Google API console at https://console.developers.google.com/
|
||||
auths.tip.openid_connect = Use the OpenID Connect Discovery URL (<server>/.well-known/openid-configuration) to specify the endpoints
|
||||
auths.tip.twitter = Go to https://dev.twitter.com/apps, create an application and ensure that the “Allow this application to be used to Sign in with Twitter” option is enabled
|
||||
auths.tip.discord = Register a new application on https://discordapp.com/developers/applications/me
|
||||
auths.edit = Edit Authentication Source
|
||||
auths.activated = This Authentication Source is Activated
|
||||
auths.new_success = The authentication '%s' has been added.
|
||||
|
|
BIN
public/img/auth/discord.png
Normal file
BIN
public/img/auth/discord.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.5 KiB |
|
@ -108,6 +108,8 @@
|
|||
<span>{{.i18n.Tr "admin.auths.tip.openid_connect"}}</span>
|
||||
<li>Twitter</li>
|
||||
<span>{{.i18n.Tr "admin.auths.tip.twitter"}}</span>
|
||||
<li>Discord</li>
|
||||
<span>{{.i18n.Tr "admin.auths.tip.discord"}}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Reference in New Issue
Block a user