Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ClearProviders ¶
func ClearProviders()
ClearProviders will remove all providers currently in use. This is useful, mostly, for testing purposes.
func ContextForClient ¶
ContextForClient provides a context for use with oauth2.
func HTTPClientWithFallBack ¶
HTTPClientWithFallBack to be used in all fetch operations.
func UseProviders ¶
func UseProviders(viders ...Provider)
UseProviders adds a list of available providers for use with Goth. Can be called multiple times. If you pass the same provider more than once, the last will be used.
Types ¶
type Provider ¶
type Provider interface { ProviderType() ProviderType GetAuthorizeURL(state string) string FetchToken(code string) (*oauth2.Token, string, error) FetchUser(token *oauth2.Token, openid string) (User, error) }
Provider needs to be implemented for each 3rd party authentication provider e.g. Facebook, Twitter, etc...
func GetProvider ¶
func GetProvider(pType ProviderType) (Provider, error)
GetProvider returns a previously created provider. If Goth has not been told to use the named provider it will return an error.
type Providers ¶
type Providers map[ProviderType]Provider
Providers is list of known/available providers.
func GetProviders ¶
func GetProviders() Providers
GetProviders returns a list of all the providers currently in use.
type User ¶
type User struct { RawData map[string]interface{} ProviderType ProviderType Email string Name string FirstName string LastName string NickName string Description string UserID string AvatarURL string Location string AccessToken string AccessTokenSecret string RefreshToken string ExpiresAt time.Time IDToken string }
User contains the information common amongst most OAuth and OAuth2 providers. All the "raw" data from the provider can be found in the `RawData` field.