oauth

package
v0.0.0-...-03884a7 Latest Latest
Warning

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

Go to latest
Published: Jul 11, 2025 License: Apache-2.0 Imports: 0 Imported by: 2

Documentation

Index

Constants

View Source
const (
	PlatformHand       = "hand"        //手动添加
	PlatformMobile     = "mobile"      //手机一键登录
	PlatformSms        = "sms"         //手机短信
	PlatformWxMini     = "wx_mini"     //微信小程序
	PlatformBaiduMini  = "baidu_mini"  //百度小程序
	PlatformAlipayMini = "alipay_mini" //支付宝小程序
	PlatformDouYinMini = "douyin_mini" //抖音小程序
	PlatformWechat     = "weixin"      //微信登录(APP通过微信登录)
	PlatformQQ         = "qq"          //QQ登录
	PlatformAlipay     = "alipay"      //支付宝登录
	PlatformDouYin     = "douyin"      //抖音登录
	PlatformWeibo      = "weibo"       //微博登录
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Oauth

type Oauth interface {
	GetName() string
	GetAuthLoginUrl(state string) string
	GetAuthUserInfo(code string) (*UserResult, error)
}

获取第三方登录地址

type OauthConfig

type OauthConfig struct {
	ClientId     string `json:"client_id"`
	ClientSecret string `json:"client_secret"`
	RedirectUri  string `json:"redirect_uri"`
}

基本配置

type Option

type Option func(*OauthConfig)

func WithClientID

func WithClientID(clientId string) Option

func WithClientSecret

func WithClientSecret(clientSecret string) Option

func WithRedirectUri

func WithRedirectUri(redirectUri string) Option

type Platform

type Platform string

注册来源

type UserResult

type UserResult struct {
	OpenId   string `json:"open_id"`    // 用户在开放平台的唯一标识
	NickName string `json:"nick_name"`  // 用户昵称
	Name     string `json:"name"`       // 用户姓名
	EnName   string `json:"en_name"`    // 用户英文名
	Avatar   string `json:"avatar_url"` // 头像URL
	Email    string `json:"email"`      // 邮箱
	Mobile   string `json:"mobile"`     // 手机号码

}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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