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" )
支持的 OAuth 提供商
Variables ¶
This section is empty.
Functions ¶
func GetOAuthByUserID ¶
GetOAuthByUserID 获取用户的OAuth绑定信息
func GetUserOAuthBindings ¶
GetUserOAuthBindings 获取用户的所有OAuth绑定
func ProcessOAuthBind ¶
ProcessOAuthBind 处理OAuth绑定(用于已登录用户)
func ProcessOAuthCallback ¶
func ProcessOAuthCallback(gothUser goth.User) (*users.EntityComplete, error)
ProcessOAuthCallback 处理OAuth回调
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 通用OAuth用户信息结构
Click to show internal directories.
Click to hide internal directories.