Documentation
¶
Index ¶
Constants ¶
const ( GITHUB = "github" FACEBOOK = "facebook" GOOGLE = "google" SLACK = "slack" )
Supported providers
Variables ¶
This section is empty.
Functions ¶
func GetProfileData ¶
GetProfileData retrieves profile data using an endpoint and a token string
func NewConfig ¶
NewConfig is a helper function to make an instance of golang.org/x/oauth2.Config. This must need two environment variables having a given prefix. For example, if prefix is `github`, the variables are `GITHUB_CLIENT_ID` and `GITHUB_CLIENT_SECRET`. Prefix is normalized with strings.ToUpper. If either value is missing, it makes panic. url is a RedirectURL of oauth2.Config
Types ¶
type Profile ¶
type Profile interface { Token() *xoauth2.Token Name() string Nickname() string AvatarURL() string }
Profile gives some methods to retrieve major values from profile data.
type Provider ¶
type Provider interface { Name() string Config() *xoauth2.Config Profile(token *xoauth2.Token) (Profile, error) }
Provider defines behaviors for oauth2 provider
func ProviderByName ¶
ProviderByName returns a provider given for nnme. This returns nil if there is no registered provider.