oauthservice

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 12, 2026 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ProviderGitHub   = "github"
	ProviderGoogle   = "google"
	ProviderFacebook = "facebook"
	ProviderTwitter  = "twitter"
)

支持的 OAuth 提供商

Variables

This section is empty.

Functions

func GetOAuthByUserID

func GetOAuthByUserID(userID uint64, provider string) *userOAuth.Entity

GetOAuthByUserID 获取用户的OAuth绑定信息

func GetUserOAuthBindings

func GetUserOAuthBindings(userID uint64) map[string]*userOAuth.Entity

GetUserOAuthBindings 获取用户的所有OAuth绑定

func InitOAuth

func InitOAuth()

InitOAuth 初始化OAuth配置

func ProcessOAuthBind

func ProcessOAuthBind(userID uint64, gothUser goth.User) error

ProcessOAuthBind 处理OAuth绑定(用于已登录用户)

func ProcessOAuthCallback

func ProcessOAuthCallback(gothUser goth.User) (*users.EntityComplete, error)

ProcessOAuthCallback 处理OAuth回调

func UnbindOAuth

func UnbindOAuth(userID uint64, provider string) error

UnbindOAuth 解绑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用户信息结构

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL