{"modulePath":"github.com/RedAFD/code-core","version":"v1.8.3","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package oauth2\n\n## Functions\n\n```go\nfunc Auth(provider string, request *http.Request, response http.ResponseWriter) error\n```\nAuth OAuth2 auth service\n\n```go\nfunc GetDefaultAuthURL(provider string) string\n```\nGetDefaultAuthURL return the default authorize url for the given provider\n\n```go\nfunc GetDefaultEmailURL(provider string) string\n```\nGetDefaultEmailURL return the default email url for the given provider\n\n```go\nfunc GetDefaultProfileURL(provider string) string\n```\nGetDefaultProfileURL return the default profile url for the given provider\n\n```go\nfunc GetDefaultTokenURL(provider string) string\n```\nGetDefaultTokenURL return the default token url for the given provider\n\n```go\nfunc Init(x *xorm.Engine) error\n```\nInit initialize the setup of the OAuth2 library\n\n```go\nfunc ProviderCallback(provider string, request *http.Request, response http.ResponseWriter) (goth.User, error)\n```\nProviderCallback handles OAuth callback, resolve to a goth user and send back to original url this will trigger a new authentication request, but because we save it in the session we can use that\n\n```go\nfunc RegisterProvider(providerName, providerType, clientID, clientSecret, openIDConnectAutoDiscoveryURL string, customURLMapping *CustomURLMapping) error\n```\nRegisterProvider register a OAuth2 provider in goth lib\n\n```go\nfunc RemoveProvider(providerName string)\n```\nRemoveProvider removes the given OAuth2 provider from the goth lib\n\n## Types\n\n```go\ntype CustomURLMapping struct {\n\tAuthURL    string\n\tTokenURL   string\n\tProfileURL string\n\tEmailURL   string\n}\n```\nCustomURLMapping describes the urls values to use when customizing OAuth2 provider URLs\n\n","path":"github.com/RedAFD/code-core/modules/auth/oauth2","name":"oauth2","synopsis":"","isRedistributable":true}
