### Install goth with go get Source: https://pkg.go.dev/github.com/markbates/goth Install the goth package using the go get command. ```bash $ go get github.com/markbates/goth ``` -------------------------------- ### Build and run goth examples Source: https://pkg.go.dev/github.com/markbates/goth Navigate to the examples directory, fetch dependencies, build, and run the example application. ```bash $ cd goth/examples $ go get -v $ go build $ ./examples ``` -------------------------------- ### Run Nextcloud login example with environment variables Source: https://pkg.go.dev/github.com/markbates/goth/providers/nextcloud Runs the default login example from the goth examples directory. Requires the Nextcloud URL, client key, secret, and a session secret. After running, you should be able to log in via Nextcloud in the examples app. ```bash NEXTCLOUD_URL=https://goth.my.server.name \ NEXTCLOUD_KEY= \ NEXTCLOUD_SECRET= \ SESSION_SECRET=1 \ ./examples ``` -------------------------------- ### Provider BeginAuth method Source: https://pkg.go.dev/github.com/markbates/goth/providers/classlink Starts the authentication process, returning a goth.Session. ```go func (p Provider) BeginAuth(state string) (goth.Session, error) ``` -------------------------------- ### Nextcloud Docker Compose setup and startup command Source: https://pkg.go.dev/github.com/markbates/goth/providers/nextcloud Sets up a Nextcloud test environment using Docker Compose with a Traefik network. The YAML defines the Nextcloud service with environment variables for admin credentials and trusted domains. The command starts the container with the NEXTCLOUD_DNS environment variable set to the public hostname. ```yaml version: '2' networks: traefik-web: external: true services: app: image: nextcloud restart: always networks: - traefik-web labels: - traefik.enable=true - traefik.frontend.rule=Host:${NEXTCLOUD_DNS} - traefik.docker.network=traefik-web environment: SQLITE_DATABASE: "database.sqlite3" NEXTCLOUD_ADMIN_USER: admin NEXTCLOUD_ADMIN_PASSWORD: admin NEXTCLOUD_TRUSTED_DOMAINS: ${NEXTCLOUD_DNS} ``` ```bash NEXTCLOUD_DNS=goth.my.server.name docker-compose up -d ``` -------------------------------- ### Clone goth source from GitHub Source: https://pkg.go.dev/github.com/markbates/goth Clone the goth repository from GitHub to run the example application. ```bash $ git clone git@github.com:markbates/goth.git ``` -------------------------------- ### Provider.BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/wecom Starts the authentication process with WeCom. ```APIDOC ## [BeginAuth] func (p *Provider) BeginAuth(state string) (goth.Session, error) ### Description Asks WeCom for an authentication end-point. ### Method Method ### Parameters - **state** (string) - Required - The state parameter for the authentication request. ### Returns - **goth.Session** - The authentication session. - **error** - An error if the operation fails. ``` -------------------------------- ### Provider.BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/eveonline Starts the authentication process by requesting an authentication URL from Eve Online. ```APIDOC ## BeginAuth ### Description Asks Eve Online for an authentication end-point. ### Signature ```go func (p *Provider) BeginAuth(state string) (goth.Session, error) ``` ### Parameters - **state** (string) - Required - The state parameter for the OAuth2 flow. ### Returns - **goth.Session** - The session to be used for the authentication flow. - **error** - An error if the authentication end-point could not be obtained. ``` -------------------------------- ### Run Nextcloud provider test with go test Source: https://pkg.go.dev/github.com/markbates/goth/providers/nextcloud Runs the provider test for Nextcloud. It uses the same environment variables as the login example but starts the test itself. The -v flag enables verbose output. ```bash NEXTCLOUD_URL=https://goth.my.server.name \ NEXTCLOUD_KEY= \ NEXTCLOUD_SECRET= \ SESSION_SECRET=1 \ go test -v ``` -------------------------------- ### Provider.BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/shopify Starts the authentication process by requesting an authentication endpoint from Shopify. ```APIDOC ## Provider.BeginAuth ### Description Asks Shopify for an authentication end-point. ### Signature `func (p *Provider) BeginAuth(state string) (goth.Session, error)` ### Parameters - **state** (string) - Required - The state parameter for OAuth. ### Returns - **goth.Session** - The session to be used for the authentication flow. - **error** - An error if the authentication endpoint could not be obtained. ``` -------------------------------- ### Provider.BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/soundcloud Starts the authentication process by requesting an authentication endpoint from Soundcloud. ```APIDOC ## BeginAuth ### Description Asks Soundcloud for an authentication end-point. ### Signature `func (p *Provider) BeginAuth(state string) (goth.Session, error)` ### Parameters - **state** (string) - Required - The state parameter for the OAuth2 flow. ### Returns - **goth.Session** - The session to be used for the authentication process. - **error** - An error if the authentication endpoint could not be obtained. ``` -------------------------------- ### Provider.BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/mailru Starts the authentication process by requesting an authentication end-point from MAILRU. ```APIDOC ## Provider.BeginAuth ### Description Asks MAILRU for an authentication end-point. ### Signature `func (p *Provider) BeginAuth(state string) (goth.Session, error)` ### Parameters - **state** (string) - Required - The state parameter for the OAuth2 flow. ### Returns - **goth.Session** - The session for the authentication process. - **error** - An error if the authentication end-point could not be obtained. ``` -------------------------------- ### func (p *Provider) BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/openidConnect Starts the OAuth2 authentication flow by creating a new session. ```APIDOC ## func (p *Provider) BeginAuth ### Description Begins the authentication process by returning a session that can be used to obtain an authorization URL. ### Signature ```go func (p *Provider) BeginAuth(state string) (goth.Session, error) ``` ### Parameters - **state** (string) - Required - The state parameter to include in the authorization request. ### Returns - **goth.Session** - A session object for the authentication flow. - **error** - An error if the session could not be created. ``` -------------------------------- ### func (p *Provider) BeginAuth(state string) (goth.Session, error) Source: https://pkg.go.dev/github.com/markbates/goth/providers/box Starts the authentication process with Box by asking for an authentication end-point. ```APIDOC ### Description BeginAuth asks Box for an authentication end-point. ### Method Signature func (p *Provider) BeginAuth(state string) (goth.Session, error) ### Parameters - **state** (string) - Required: The state parameter to protect against cross-site request forgery. ### Returns - **Session** (goth.Session) - The session for the authentication process. - **error** (error) - An error if the authentication endpoint cannot be obtained. ### Usage Example ```go session, err := provider.BeginAuth("state") ``` ``` -------------------------------- ### GitHub Enterprise custom URL example Source: https://pkg.go.dev/github.com/markbates/goth/providers/github Shows how to override the default GitHub URLs for GitHub Enterprise. Note the missing closing quotes in the source example. ```go github.AuthURL = "https://github.acme.com/login/oauth/authorize github.TokenURL = "https://github.acme.com/login/oauth/access_token github.ProfileURL = "https://github.acme.com/api/v3/user github.EmailURL = "https://github.acme.com/api/v3/user/emails ``` -------------------------------- ### Provider.BeginAuth(state string) (goth.Session, error) Source: https://pkg.go.dev/github.com/markbates/goth/providers/yahoo Starts the authentication process by requesting Yahoo for an authentication endpoint. Returns a session to be used in the OAuth flow. ```APIDOC ## Provider.BeginAuth(state string) (goth.Session, error) ### Description Asks Yahoo for an authentication end-point and returns a session to be used in the OAuth flow. ### Method BeginAuth ### Signature `func (p *Provider) BeginAuth(state string) (goth.Session, error)` ### Parameters - **state** (string) - Required - State value for CSRF protection. ### Returns - **session** (goth.Session) - Session object for the auth process. - **error** (error) - Error if the request fails. ``` -------------------------------- ### bitly.New function signature Source: https://pkg.go.dev/github.com/markbates/goth/providers/bitly New creates a new Bitly provider and sets up important connection details. Always call bitly.New to get a new provider; never create one manually. ```go func New(clientKey, secret, callbackURL string, scopes ...string) *Provider ``` -------------------------------- ### func (p *Provider) BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/amazon Starts the authentication process by requesting an authentication endpoint from Amazon. ```APIDOC ## func (p *Provider) BeginAuth ### Description BeginAuth asks Amazon for an authentication end-point. ### Signature `func (p *Provider) BeginAuth(state string) (goth.Session, error)` ### Parameters - **state** (string) - Required - The state parameter for the OAuth2 flow. ### Returns - **goth.Session** - The authentication session. - **error** - An error if the authentication endpoint could not be obtained. ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/gitlab New creates a new Gitlab provider and sets up important connection details. You should always call `gitlab.New` to get a new provider. Never try to create one manually. ```APIDOC ## New ### Description New creates a new Gitlab provider and sets up important connection details. You should always call `gitlab.New` to get a new provider. Never try to create one manually. ### Method New ### Parameters - **clientKey** (string) - Required - The client key for the Gitlab application. - **secret** (string) - Required - The secret for the Gitlab application. - **callbackURL** (string) - Required - The callback URL for the OAuth flow. - **scopes** (variadic string) - Optional - Additional OAuth scopes. ### Returns - **provider** (*Provider) - The newly created Gitlab provider. ``` -------------------------------- ### func New Source: https://pkg.go.dev/github.com/markbates/goth/providers/naver New creates a new Provider and sets up important connection details. Always call naver.New to get a new Provider; never create one manually. Naver only supports pre-defined scopes, so visit the Naver Developer page to define your application's OAuth scope. ```go func New(clientKey, secret, callbackURL string) *Provider ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/tumblr Creates a new Tumblr provider and sets up important connection details. You should always call `tumblr.New` to get a new Provider. Never try to create one manually. If you'd like to use authenticate instead of authorize, use NewAuthenticate instead. ```APIDOC ## New ### Description Creates a new Tumblr provider and sets up important connection details. You should always call `tumblr.New` to get a new Provider. Never try to create one manually. If you'd like to use authenticate instead of authorize, use NewAuthenticate instead. ### Method Constructor ### Signature `func New(clientKey, secret, callbackURL string) *Provider` ### Parameters - **clientKey** (string) - Required - The Tumblr client key. - **secret** (string) - Required - The Tumblr client secret. - **callbackURL** (string) - Required - The callback URL for OAuth. ### Returns - **\*Provider** - A new Tumblr provider instance. ``` -------------------------------- ### func New Source: https://pkg.go.dev/github.com/markbates/goth/providers/bitbucket New creates a new Bitbucket provider with the given client key, secret, callback URL, and optional scopes. Always call bitbucket.New to get a new Provider; never create one manually. ```go func New(clientKey, secret, callbackURL string, scopes ...string) *Provider ``` -------------------------------- ### func New(clientKey, secret, callbackURL string, scopes ...string) *Provider Source: https://pkg.go.dev/github.com/markbates/goth/providers/spotify Creates a new Spotify provider and sets up important connection details. Always call spotify.New to get a new Provider; never create one manually. ```APIDOC ## func New(clientKey, secret, callbackURL string, scopes ...string) *Provider ### Description Creates a new Spotify provider and sets up important connection details. Always call spotify.New to get a new Provider; never create one manually. ### Signature func New(clientKey, secret, callbackURL string, scopes ...string) *Provider ### Parameters - **clientKey** (string) - Required - The Spotify client key. - **secret** (string) - Required - The Spotify client secret. - **callbackURL** (string) - Required - The callback URL for OAuth redirect. - **scopes** (variadic string) - Optional - Additional OAuth scopes to request. ### Returns - **\*Provider** - A new Spotify provider instance. ``` -------------------------------- ### Nextcloud default admin credentials Source: https://pkg.go.dev/github.com/markbates/goth/providers/nextcloud The default credentials for the Nextcloud instance started with the Docker Compose setup: username 'admin' and password 'admin'. ```text admin / admin ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/battlenet Creates a new Battle.net provider with the given client key, secret, callback URL, and optional scopes. This is the recommended way to instantiate a provider. ```APIDOC ## New ### Description Creates a new Battle.net provider and sets up important connection details. You should always call `battlenet.New` to get a new provider. Never try to create one manually. ### Method New ### Signature `func New(clientKey, secret, callbackURL string, scopes ...string) *Provider` ### Parameters - **clientKey** (string) - Required - The client key for the Battle.net application. - **secret** (string) - Required - The client secret for the Battle.net application. - **callbackURL** (string) - Required - The callback URL for the OAuth2 flow. - **scopes** (variadic string) - Optional - Additional OAuth2 scopes to request. ### Returns - **Provider** (*Provider) - A new Battle.net provider instance. ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/soundcloud Constructor for creating a new Soundcloud provider instance. ```APIDOC ## New ### Description Creates a new Soundcloud provider and sets up important connection details. Always call `soundcloud.New` to get a new provider; never create one manually. ### Signature `func New(clientKey, secret, callbackURL string, scopes ...string) *Provider` ### Parameters - **clientKey** (string) - Required - The client key for the Soundcloud application. - **secret** (string) - Required - The secret for the Soundcloud application. - **callbackURL** (string) - Required - The callback URL for the OAuth2 flow. - **scopes** (string) - Optional - Additional OAuth2 scopes. ### Returns - **\*Provider** - A new Soundcloud provider instance. ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/dailymotion Creates a new Dailymotion provider with the given client key, secret, callback URL, and optional scopes. ```APIDOC ## New ### Description Creates a new Dailymotion provider and sets up important connection details. You should always call `dailymotion.New` to get a new provider. Never try to create one manually. ### Method New ### Endpoint New(clientKey string, secret string, callbackURL string, scopes ...string) *Provider ### Parameters #### Parameters - **clientKey** (string) - Required - The client key for the Dailymotion application. - **secret** (string) - Required - The secret for the Dailymotion application. - **callbackURL** (string) - Required - The callback URL for the OAuth2 flow. - **scopes** (string) - Optional - Additional scopes for the OAuth2 flow. ### Request Example ```go provider := dailymotion.New("clientKey", "secret", "callbackURL", "scope1", "scope2") ``` ### Response #### Success Response - **provider** (*Provider) - The newly created Dailymotion provider. #### Response Example ```go provider := &dailymotion.Provider{ClientKey: "clientKey", Secret: "secret", CallbackURL: "callbackURL"} ``` ``` -------------------------------- ### BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/dailymotion Begins the authentication process by requesting an authentication end-point from Dailymotion. ```APIDOC ## BeginAuth ### Description Asks Dailymotion for an authentication end-point. ### Method BeginAuth ### Endpoint func (p *Provider) BeginAuth(state string) (goth.Session, error) ### Parameters #### Parameters - **state** (string) - Required - The state parameter for the OAuth2 flow. ### Request Example ```go session, err := provider.BeginAuth("state") ``` ### Response #### Success Response - **session** (goth.Session) - The session to be used for the authentication flow. #### Error Response - **error** (error) - An error if the authentication end-point could not be obtained. #### Response Example ```go session := &dailymotion.Session{AuthURL: "https://api.dailymotion.com/oauth/authorize"} ``` ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/eveonline Constructor for creating a new Eve Online OAuth2 provider. ```APIDOC ## New ### Description Creates a new Eve Online provider and sets up important connection details. Always call `eveonline.New` to get a new provider; never create one manually. ### Signature ```go func New(clientKey, secret, callbackURL string, scopes ...string) *Provider ``` ### Parameters - **clientKey** (string) - Required - The client key for the Eve Online application. - **secret** (string) - Required - The secret for the Eve Online application. - **callbackURL** (string) - Required - The callback URL for the OAuth2 flow. - **scopes** (variadic string) - Optional - Additional OAuth2 scopes to request. ### Returns - **\*Provider** - A new Eve Online provider instance. ``` -------------------------------- ### GetSession method signature Source: https://pkg.go.dev/github.com/markbates/goth/providers/lastfm Gets a session token from LastFM. ```go func (p *Provider) GetSession(token string) (map[string]string, error) ``` -------------------------------- ### func (*Provider) BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/bitbucket BeginAuth asks Bitbucket for an authentication end-point. ```go func (p *Provider) BeginAuth(state string) (goth.Session, error) ``` -------------------------------- ### func New Source: https://pkg.go.dev/github.com/markbates/goth/providers/spotify Creates a new Spotify provider instance with the given credentials and scopes. ```APIDOC ## [FUNCTION] func New ### Description Creates a new Spotify provider with the given client ID, secret, and callback URL. ### Signature ```go func New(clientKey, secret, callbackURL string, scopes ...string) *Provider ``` ### Parameters - **clientKey** (string) - Required - The Spotify client ID. - **secret** (string) - Required - The Spotify client secret. - **callbackURL** (string) - Required - The callback URL for OAuth2. - **scopes** (string) - Optional - Additional OAuth2 scopes. ### Returns - **\*Provider** - A new Spotify provider instance. ``` -------------------------------- ### Provider.BeginAuth method signature Source: https://pkg.go.dev/github.com/markbates/goth/providers/bitly BeginAuth asks Bitly for an authentication end-point. ```go func (p *Provider) BeginAuth(state string) (goth.Session, error) ``` -------------------------------- ### Provider.BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/battlenet Begins the authentication process by asking Battle.net for an authentication endpoint. Returns a session that can be used to redirect the user. ```APIDOC ## Provider.BeginAuth ### Description Asks Battle.net for an authentication end-point. This is the first step in the OAuth2 flow. ### Method BeginAuth ### Signature `func (p *Provider) BeginAuth(state string) (goth.Session, error)` ### Parameters - **state** (string) - Required - The state parameter for CSRF protection. ### Returns - **goth.Session** - A session object for the authentication process. - **error** - An error if the authentication endpoint could not be obtained. ``` -------------------------------- ### GetClient - Get HTTP Client Source: https://pkg.go.dev/github.com/markbates/goth/providers/tiktok GetClient returns the HTTP client used by the provider. ```go func (p *Provider) GetClient() *http.Client ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/openidConnect Creates a new OpenID Connect provider with auto-discovery. Sets up important connection details and returns an implementation of the OpenID Connect Authorization Code Flow. ```APIDOC ## New ### Description Creates a new OpenID Connect provider, and sets up important connection details. You should always call `openidConnect.New` to get a new Provider. Never try to create one manually. New returns an implementation of an OpenID Connect Authorization Code Flow. ID Token decryption is not (yet) supported. UserInfo decryption is not (yet) supported. ### Function Signature ```go func New(clientKey, secret, callbackURL, openIDAutoDiscoveryURL string, scopes ...string) (*Provider, error) ``` ### Parameters - **clientKey** (string) - Required - The client key (client ID) for the OIDC provider. - **secret** (string) - Required - The client secret for the OIDC provider. - **callbackURL** (string) - Required - The callback URL for the OAuth flow. - **openIDAutoDiscoveryURL** (string) - Required - The URL for OpenID Connect auto-discovery. - **scopes** (variadic string) - Optional - Additional scopes to request. ### Returns - **Provider** (*Provider) - The new provider instance. - **error** (error) - An error if creation fails. ``` -------------------------------- ### func (*Provider) RefreshToken Source: https://pkg.go.dev/github.com/markbates/goth/providers/bitbucket RefreshToken gets a new access token based on the refresh token. ```go func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) ``` -------------------------------- ### New function signature Source: https://pkg.go.dev/github.com/markbates/goth/providers/dailymotion Constructor for creating a new Dailymotion provider. Always use this function instead of manually creating a Provider. ```go func New(clientKey string, secret string, callbackURL string, scopes ...string) *Provider ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/xero Creates a new Xero provider with the given client key, secret, and callback URL. ```APIDOC ## New ### Description Creates a new Xero provider and sets up important connection details. Always call `xero.New` to get a new Provider; never try to create one manually. ### Method New ### Parameters - **clientKey** (string) - Required - The client key for the Xero application. - **secret** (string) - Required - The secret for the Xero application. - **callbackURL** (string) - Required - The callback URL for the OAuth flow. ### Returns - **\*Provider** - A new Xero provider instance. ``` -------------------------------- ### func (s *Session) GetAuthURL() (string, error) Source: https://pkg.go.dev/github.com/markbates/goth/providers/dropbox Gets the URL set by calling the BeginAuth function on the Dropbox provider. ```APIDOC ## func (s *Session) GetAuthURL() (string, error) ### Description Gets the URL set by calling the BeginAuth function on the Dropbox provider. ### Signature `func (s *Session) GetAuthURL() (string, error)` ### Returns - **string** - The authentication URL. - **error** - An error if the operation fails. ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/apple Creates a new Apple provider with the given client ID, secret, redirect URL, and optional scopes. ```APIDOC ## New ### Description Creates a new Apple provider with the given client ID, secret, redirect URL, and optional scopes. ### Function Signature ```go func New(clientId, secret, redirectURL string, httpClient *http.Client, scopes ...string) *Provider ``` ### Parameters - **clientId** (string) - Required - The client ID. - **secret** (string) - Required - The client secret. - **redirectURL** (string) - Required - The redirect URL. - **httpClient** (*http.Client) - Required - The HTTP client to use. - **scopes** (...string) - Optional - Additional scopes. ### Returns - **Provider** - A new Apple provider. ``` -------------------------------- ### Override gothic.Store with custom cookie options Source: https://pkg.go.dev/github.com/markbates/goth Example of overriding the gothic.Store variable at startup to customize cookie settings such as MaxAge, Path, HttpOnly, and Secure. ```go key := "" // Replace with your SESSION_SECRET or similar maxAge := 86400 * 30 // 30 days isProd := false // Set to true when serving over https store := sessions.NewCookieStore([]byte(key)) store.MaxAge(maxAge) store.Options.Path = "/" store.Options.HttpOnly = true // HttpOnly should always be enabled store.Options.Secure = isProd gothic.Store = store ``` -------------------------------- ### Provider.BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/seatalk Begins the authentication process with SeaTalk, returning a session with the authorization URL. ```APIDOC ## Provider.BeginAuth ### Description Asks SeaTalk for an authentication endpoint. ### Function Signature `func (p *Provider) BeginAuth(state string) (goth.Session, error)` ### Parameters - **state** (string) - Required - The state parameter for the OAuth flow. ### Returns - **goth.Session** - The session containing the authorization URL. - **error** - An error if the authentication endpoint could not be obtained. ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/google Creates a new Google provider instance with the given client key, secret, callback URL, and optional scopes. ```APIDOC ## [FUNCTION] New ### Description Creates a new Google provider, and sets up important connection details. You should always call `google.New` to get a new Provider. Never try to create one manually. ### Signature `func New(clientKey, secret, callbackURL string, scopes ...string) *Provider` ### Parameters - **clientKey** (string) - Required - The client key for the Google OAuth application. - **secret** (string) - Required - The secret for the Google OAuth application. - **callbackURL** (string) - Required - The callback URL for the OAuth flow. - **scopes** (string) - Optional - Additional OAuth scopes to request. ### Returns - **\*Provider** - A new Google provider instance. ``` -------------------------------- ### GetProviderName variable Source: https://pkg.go.dev/github.com/markbates/goth/gothic Variable holding a function to get the provider name for a request. By default it fetches from the URL query string; assign your own function to customize. ```go var GetProviderName = getProviderName ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/uber Creates a new Uber provider instance with the given client credentials and callback URL. ```APIDOC ## New ### Description Creates a new Uber provider and sets up important connection details. You should always call `uber.New` to get a new provider. Never try to create one manually. ### Function Signature `func New(clientKey, secret, callbackURL string, scopes ...string) *Provider` ### Parameters - **clientKey** (string) - Required - The client key for the Uber OAuth2 application. - **secret** (string) - Required - The client secret for the Uber OAuth2 application. - **callbackURL** (string) - Required - The callback URL to redirect to after authentication. - **scopes** (string) - Optional - Additional OAuth2 scopes to request. ### Returns - **Provider** (*Provider) - A new Uber provider instance. ``` -------------------------------- ### GetState variable Source: https://pkg.go.dev/github.com/markbates/goth/gothic Gets the state returned by the provider during the callback. Used to prevent CSRF attacks. For POST requests with no query parameters, it reads from the form value. ```go var GetState = func(req *http.Request) string { params := req.URL.Query() if params.Encode() == "" && req.Method == http.MethodPost { return req.FormValue("state") } return params.Get("state") } ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/wecom Constructor for creating a new WeCom provider. ```APIDOC ## [New] New(corpID, secret, agentID, callbackURL string) *Provider ### Description Creates a new WeCom provider and sets up important connection details. ### Method Constructor ### Parameters - **corpID** (string) - Required - The corporate ID for WeCom. - **secret** (string) - Required - The secret key for WeCom. - **agentID** (string) - Required - The agent ID for WeCom. - **callbackURL** (string) - Required - The callback URL for authentication. ### Returns - **Provider** (*Provider) - A new WeCom provider instance. ``` -------------------------------- ### BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/xero Initiates the OAuth flow with Xero, returning a session for the authentication process. ```APIDOC ## BeginAuth ### Description Begins the authentication process with Xero by requesting an authentication endpoint and a request token for a session. Xero does not support the "state" variable. ### Method BeginAuth ### Parameters - **state** (string) - Required - The state parameter (ignored by Xero). ### Returns - **goth.Session** - The session to be used for the authentication flow. - **error** - An error if the authentication initiation fails. ``` -------------------------------- ### func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error) Source: https://pkg.go.dev/github.com/markbates/goth/providers/cloudfoundry Gets a new access token based on the refresh token. Returns the new token and an error if the refresh fails. ```APIDOC ## func (p *Provider) RefreshToken ### Description Gets a new access token based on the refresh token. Returns the new token and an error if the refresh fails. ### Signature `func (p *Provider) RefreshToken(refreshToken string) (*oauth2.Token, error)` ### Parameters - **refreshToken** (string) - Required - The refresh token to use. ### Returns - **\*oauth2.Token** - The new access token. - **error** - An error if the token refresh fails. ``` -------------------------------- ### BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/gitea Begins the authentication process with Gitea by requesting an authentication endpoint. ```APIDOC ## BeginAuth ### Description Asks Gitea for an authentication end-point. ### Method BeginAuth ### Parameters - **state** (string) - Required - The state parameter for the OAuth flow. ### Returns - **goth.Session** - The session to be used for the authentication process. - **error** - An error if the authentication endpoint could not be obtained. ``` -------------------------------- ### New function to create Auth0 provider Source: https://pkg.go.dev/github.com/markbates/goth/providers/auth0 New creates a new Auth0 provider and sets up important connection details. Always call auth0.New to get a new provider, never manually. ```go func New(clientKey, secret, callbackURL string, auth0Domain string, scopes ...string) *Provider ``` -------------------------------- ### Provider.BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/apple Begins the authentication process for Apple Sign-In. ```APIDOC ## BeginAuth ### Description Begins the authentication process for Apple Sign-In. ### Function Signature ```go func (p Provider) BeginAuth(state string) (goth.Session, error) ``` ### Parameters - **state** (string) - Required - The state parameter for OAuth. ### Returns - **goth.Session** - The authentication session. - **error** - An error if the process fails. ``` -------------------------------- ### Gitlab AuthURL, TokenURL, ProfileURL variables and custom URL example Source: https://pkg.go.dev/github.com/markbates/goth/providers/gitlab Defines the default Gitlab OAuth endpoints. Override these variables before calling New when using Gitlab CE or EE with custom URLs. ```go var ( AuthURL = "https://gitlab.com/oauth/authorize" TokenURL = "https://gitlab.com/oauth/token" ProfileURL = "https://gitlab.com/api/v3/user" ) ``` ```go gitlab.AuthURL = "https://gitlab.acme.com/oauth/authorize" gitlab.TokenURL = "https://gitlab.acme.com/oauth/token" gitlab.ProfileURL = "https://gitlab.acme.com/api/v3/user" ``` -------------------------------- ### BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/slack Begins the authentication process by requesting an authentication endpoint from Slack. ```APIDOC ## BeginAuth ### Description Asks Slack for an authentication end-point. ### Method BeginAuth ### Signature `func (p *Provider) BeginAuth(state string) (goth.Session, error)` ### Parameters - **state** (string) - Required - The state parameter for the OAuth2 flow. ### Returns - **goth.Session** - The session to be used for the authentication process. - **error** - An error if the authentication endpoint could not be obtained. ``` -------------------------------- ### func New(clientKey, secret, callbackURL string, scopes ...string) *Provider Source: https://pkg.go.dev/github.com/markbates/goth/providers/microsoftonline Creates a new microsoftonline provider and sets up important connection details. You should always call microsoftonline.New to get a new Provider. ```APIDOC ## func New ### Description Creates a new microsoftonline provider and sets up important connection details. You should always call microsoftonline.New to get a new Provider. Never try to create one manually. ### Signature `func New(clientKey, secret, callbackURL string, scopes ...string) *Provider` ### Parameters - **clientKey** (string) - Required - The client key for the OAuth2 application. - **secret** (string) - Required - The secret for the OAuth2 application. - **callbackURL** (string) - Required - The callback URL for the OAuth2 flow. - **scopes** (...string) - Optional - Additional scopes to request. ### Returns - **\*Provider** - A new Provider instance. ``` -------------------------------- ### func (p *Provider) SetPrompt(prompt ...string) Source: https://pkg.go.dev/github.com/markbates/goth/providers/gplus Sets the prompt values for the GPlus OAuth call. Use this to force users to choose an account every time by passing "select_account", for example. ```APIDOC ## func (p *Provider) SetPrompt ### Description Sets the prompt values for the GPlus OAuth call. Use this to force users to choose and account every time by passing "select_account", for example. See https://developers.google.com/identity/protocols/OpenIDConnect#authenticationuriparameters ### Signature `func (p *Provider) SetPrompt(prompt ...string)` ### Parameters - **prompt** (variadic string) - Optional - The prompt values to set. ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/patreon Creates a new Patreon provider with the given client key, secret, callback URL, and optional scopes. ```APIDOC ## New ### Description Creates a new Patreon provider and sets up important connection details. You should always call `patreon.New` to get a new provider. Never try to create one manually. ### Method New ### Signature `func New(clientKey, secret, callbackURL string, scopes ...string) *Provider` ### Parameters - **clientKey** (string) - Required - The client key for the Patreon application. - **secret** (string) - Required - The client secret for the Patreon application. - **callbackURL** (string) - Required - The callback URL for the OAuth flow. - **scopes** (variadic string) - Optional - Additional scopes to request. ### Returns - **\*Provider** - A new Patreon provider instance. ``` -------------------------------- ### func New(clientKey, secret, callbackURL string, scopes ...string) *Provider Source: https://pkg.go.dev/github.com/markbates/goth/providers/yammer New creates a new Yammer provider and sets up important connection details. You should always call yammer.New to get a new provider. ```APIDOC ## New ### Description New creates a new Yammer provider and sets up important connection details. You should always call yammer.New to get a new provider. Never try to create one manually. ### Function Signature ```go func New(clientKey, secret, callbackURL string, scopes ...string) *Provider ``` ### Parameters - **clientKey** (string) - The client key for the Yammer application. - **secret** (string) - The client secret for the Yammer application. - **callbackURL** (string) - The callback URL for the OAuth2 flow. - **scopes** (variadic string) - Optional scopes to request. ### Returns - **\*Provider** - A new Yammer provider instance. ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/slack Creates a new Slack provider instance with the given client key, secret, callback URL, and optional scopes. ```APIDOC ## New ### Description Creates a new Slack provider and sets up important connection details. You should always call `slack.New` to get a new provider. Never try to create one manually. ### Method New ### Signature `func New(clientKey, secret, callbackURL string, scopes ...string) *Provider` ### Parameters - **clientKey** (string) - Required - The client key for the Slack application. - **secret** (string) - Required - The secret for the Slack application. - **callbackURL** (string) - Required - The callback URL for the OAuth2 flow. - **scopes** (variadic string) - Optional - Additional scopes to request. ### Returns - **\*Provider** - A new Slack provider instance. ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/gitea Creates a new Gitea provider with the given client key, secret, callback URL, and optional scopes. ```APIDOC ## New ### Description Creates a new Gitea provider and sets up important connection details. You should always call `gitea.New` to get a new provider. Never try to create one manually. ### Method New ### Parameters - **clientKey** (string) - Required - The client key for the Gitea application. - **secret** (string) - Required - The secret for the Gitea application. - **callbackURL** (string) - Required - The callback URL for the OAuth flow. - **scopes** (variadic string) - Optional - Additional OAuth scopes. ### Returns - **\*Provider** - A new Gitea provider instance. ``` -------------------------------- ### func New(apiKey string, callbackURL string) *Provider Source: https://pkg.go.dev/github.com/markbates/goth/providers/steam New creates a new Steam provider and sets up important connection details. Always call steam.New to get a new Provider; never create one manually. ```go func New(apiKey string, callbackURL string) *Provider ``` -------------------------------- ### BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/patreon Begins the authentication process by requesting an authentication endpoint from Patreon. ```APIDOC ## BeginAuth ### Description Asks Patreon for an authentication end-point. ### Method BeginAuth ### Signature `func (p *Provider) BeginAuth(state string) (goth.Session, error)` ### Parameters - **state** (string) - Required - The state parameter for the OAuth flow. ### Returns - **goth.Session** - The session to be used for the authentication process. - **error** - An error if the authentication endpoint could not be obtained. ``` -------------------------------- ### func New(clientKey, secret, callbackURL string, auth0Domain string, scopes ...string) *Provider Source: https://pkg.go.dev/github.com/markbates/goth/providers/auth0 Creates a new Auth0 provider and sets up important connection details. You should always call auth0.New to get a new provider. ```APIDOC ## func New ### Description Creates a new Auth0 provider and sets up important connection details. You should always call `auth0.New` to get a new provider. Never try to create one manually. ### Signature `func New(clientKey, secret, callbackURL string, auth0Domain string, scopes ...string) *Provider` ### Parameters - **clientKey** (string) - Required - The client key for the Auth0 application. - **secret** (string) - Required - The client secret for the Auth0 application. - **callbackURL** (string) - Required - The callback URL for the OAuth2 flow. - **auth0Domain** (string) - Required - The Auth0 domain. - **scopes** (...string) - Optional - Additional OAuth2 scopes. ### Returns - **\*Provider** - A new Auth0 provider instance. ``` -------------------------------- ### func (p *Provider) BeginAuth(state string) (goth.Session, error) Source: https://pkg.go.dev/github.com/markbates/goth/providers/azuread Begins authentication by asking AzureAD for an authentication end-point. ```APIDOC ## func (p *Provider) BeginAuth(state string) (goth.Session, error) ### Description Begins authentication by asking AzureAD for an authentication end-point. ### Signature `func (p *Provider) BeginAuth(state string) (goth.Session, error)` ### Parameters - `state` (string) - State parameter for the OAuth flow. ### Returns - `goth.Session` - The session object. - `error` - An error if the operation fails. ``` -------------------------------- ### func New(clientKey, secret, callbackURL string, scopes ...string) *Provider Source: https://pkg.go.dev/github.com/markbates/goth/providers/box Creates a new Box provider with important connection details. You should always call box.New to get a new provider, never manually create the struct. ```APIDOC ### Description Creates a new Box provider and sets up important connection details. You should always call `box.New` to get a new provider. Never try to create one manually. ### Function Signature func New(clientKey, secret, callbackURL string, scopes ...string) *Provider ### Parameters - **clientKey** (string) - Required - The client key for the Box application. - **secret** (string) - Required - The client secret for the Box application. - **callbackURL** (string) - Required - The callback URL for the OAuth2 flow. - **scopes** (string) - Optional: A variadic list of OAuth2 scopes to request. ### Returns - **Provider** (*Provider) - The configured Box provider. ``` -------------------------------- ### func New(clientKey, secret, callbackURL string, scopes ...string) *Provider Source: https://pkg.go.dev/github.com/markbates/goth/providers/linkedin Creates a new LinkedIn provider and sets up important connection details. Always call this function to get a new Provider, never create one manually. ```APIDOC ## func New(clientKey, secret, callbackURL string, scopes ...string) *Provider ### Description Creates a new LinkedIn provider and sets up important connection details. Always call this function to get a new Provider, never create one manually. ### Signature `func New(clientKey, secret, callbackURL string, scopes ...string) *Provider` ### Parameters - **clientKey** (string) - Required - The client key for the LinkedIn application. - **secret** (string) - Required - The client secret for the LinkedIn application. - **callbackURL** (string) - Required - The callback URL for the OAuth2 flow. - **scopes** (variadic string) - Optional - Additional scopes to request. ### Returns - **\*Provider** - A new LinkedIn provider instance. ``` -------------------------------- ### func New(clientKey, secret, callbackURL string, scopes ...string) *Provider Source: https://pkg.go.dev/github.com/markbates/goth/providers/heroku Creates a new Heroku provider and sets up important connection details. Always call heroku.New to get a new provider; never create one manually. ```APIDOC ## func New ### Description Creates a new Heroku provider and sets up important connection details. Always call heroku.New to get a new provider; never create one manually. ### Signature `func New(clientKey, secret, callbackURL string, scopes ...string) *Provider` ### Parameters - **clientKey** (string) - Required - The client key for the Heroku OAuth2 application. - **secret** (string) - Required - The client secret for the Heroku OAuth2 application. - **callbackURL** (string) - Required - The callback URL to redirect to after authentication. - **scopes** (variadic string) - Optional - Additional OAuth2 scopes to request. ### Returns - **\*Provider** - A new Heroku provider instance. ``` -------------------------------- ### func New(clientKey, secret, callbackURL string, scopes ...string) *Provider Source: https://pkg.go.dev/github.com/markbates/goth/providers/digitalocean Creates a new DigitalOcean provider and sets up important connection details. Always call digitalocean.New to get a new Provider, never create one manually. ```APIDOC ## func New(clientKey, secret, callbackURL string, scopes ...string) *Provider ### Description Creates a new DigitalOcean provider and sets up important connection details. Always call digitalocean.New to get a new Provider, never create one manually. ### Signature `func New(clientKey, secret, callbackURL string, scopes ...string) *Provider` ### Parameters - **clientKey** (string) - Required - The client key for the DigitalOcean OAuth2 application. - **secret** (string) - Required - The secret for the DigitalOcean OAuth2 application. - **callbackURL** (string) - Required - The callback URL for the OAuth2 flow. - **scopes** (variadic string) - Optional - Additional OAuth2 scopes. ### Returns - **\*Provider** - A new DigitalOcean provider instance. ``` -------------------------------- ### BeginAuth Source: https://pkg.go.dev/github.com/markbates/goth/providers/faux Begins the authentication process for the faux provider. Used only for testing purposes. ```APIDOC ## BeginAuth ### Description Begins the authentication process for the faux provider. Used only for testing purposes. ### Method BeginAuth ### Signature func (p *Provider) BeginAuth(state string) (goth.Session, error) ### Parameters - **state** (string) - Required - The state parameter for the authentication flow. ### Returns - **goth.Session** - The session object for the authentication flow. - **error** - An error if the operation fails. ``` -------------------------------- ### New Source: https://pkg.go.dev/github.com/markbates/goth/providers/kakao Creates a new Kakao provider instance with the given client key, secret, callback URL, and optional scopes. ```APIDOC ## New ### Description New creates a new Kakao provider and sets up important connection details. You should always call `kakao.New` to get a new provider. Never try to create one manually. ### Method New ### Endpoint New(clientKey, secret, callbackURL string, scopes ...string) *Provider ### Parameters - **clientKey** (string) - Required - The client key for the Kakao OAuth2 application. - **secret** (string) - Required - The secret for the Kakao OAuth2 application. - **callbackURL** (string) - Required - The callback URL to redirect to after authentication. - **scopes** (variadic string) - Optional - Additional OAuth2 scopes to request. ### Returns - **\*Provider** - A new Kakao provider instance. ``` -------------------------------- ### func New(clientKey, secret, callbackURL string, scopes ...string) *Provider Source: https://pkg.go.dev/github.com/markbates/goth/providers/wepay Creates a new Wepay provider and sets up important connection details. You should always call wepay.New to get a new provider. Never try to create one manually. ```APIDOC ## func New(clientKey, secret, callbackURL string, scopes ...string) *Provider ### Description Creates a new Wepay provider and sets up important connection details. You should always call wepay.New to get a new provider. Never try to create one manually. ### Signature func New(clientKey, secret, callbackURL string, scopes ...string) *Provider ### Parameters - **clientKey** (string) - Required - The client key for the Wepay application. - **secret** (string) - Required - The secret for the Wepay application. - **callbackURL** (string) - Required - The callback URL for the OAuth2 flow. - **scopes** (...string) - Optional - Additional scopes to request. ### Returns - **\*Provider** - A new Wepay provider instance. ```