Documentation
¶
Index ¶
- Constants
- func GetOAuthByUserID(userID uint64, provider string) *userOAuth.Entity
- func GetUserOAuthBindings(userID uint64) map[string]*userOAuth.Entity
- func InitOAuth()
- func ProcessOAuthBind(userID uint64, gothUser goth.User) error
- func ProcessOAuthCallback(gothUser goth.User) (*users.EntityComplete, error)
- func UnbindOAuth(userID uint64, provider string) error
- type OAuthUserInfo
Constants ¶
View Source
const ( ProviderGitHub = "github" ProviderGoogle = "google" ProviderFacebook = "facebook" ProviderTwitter = "twitter" )
Variables ¶
This section is empty.
Functions ¶
func GetOAuthByUserID ¶
GetOAuthByUserID returns a user's OAuth binding for a provider.
func GetUserOAuthBindings ¶
GetUserOAuthBindings returns active OAuth bindings keyed by provider.
func ProcessOAuthBind ¶
ProcessOAuthBind binds a provider account to an existing user.
func ProcessOAuthCallback ¶
func ProcessOAuthCallback(gothUser goth.User) (*users.EntityComplete, error)
ProcessOAuthCallback logs in an existing OAuth user or creates a new one.
func UnbindOAuth ¶
UnbindOAuth removes one OAuth binding after safety checks.
Types ¶
type OAuthUserInfo ¶
type OAuthUserInfo struct {
ID string `json:"id"`
Login string `json:"login"`
Name string `json:"name"`
Email string `json:"email"`
AvatarURL string `json:"avatar_url"`
Bio string `json:"bio"`
Blog string `json:"blog"`
Location string `json:"location"`
Provider string `json:"provider"`
}
OAuthUserInfo is the normalized user data from an OAuth provider.
Click to show internal directories.
Click to hide internal directories.