oauth

package
v0.0.0-...-783c0ba Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2020 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetQQOpenId

func GetQQOpenId(token QQAccessToken) (openid string, err error)

获取OpenId

Types

type GiteeAccessToken

type GiteeAccessToken struct {
	AccessToken  string `json:"access_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Scope        string `json:"scope"`
	CreatedAt    int    `json:"created_at"`
}

gitee accesstoken 数据

func GetGiteeAccessToken

func GetGiteeAccessToken(code string) (token GiteeAccessToken, err error)

获取accessToken

type GiteeUser

type GiteeUser struct {
	Id        int       `json:"id"`                                  //用户id
	MemberId  int       `json:"member_id"`                           //绑定的用户id
	UpdatedAt time.Time `json:"updated_at"`                          //用户资料更新时间
	AvatarURL string    `json:"avatar_url" orm:"column(avatar_url)"` //用户头像链接
	Email     string    `json:"email" orm:"size(50)"`                //电子邮箱
	Login     string    `json:"login" orm:"size(50)"`                //用户名
	Name      string    `json:"name" orm:"size(50)"`                 //昵称
	HtmlURL   string    `json:"html_url" orm:"column(html_url)"`     //gitee主页
}

gitee 用户数据 用户使用gitee登录的时候,直接根据gitee的id获取数据

func GetGiteeUserInfo

func GetGiteeUserInfo(accessToken string) (info GiteeUser, err error)

获取用户信息

type GithubAccessToken

type GithubAccessToken struct {
	AccessToken string `json:"access_token"`
	TokenType   string `json:"token_type"`
	Scope       string `json:"scope"`
}

GitHub accesstoken 数据

func GetGithubAccessToken

func GetGithubAccessToken(code string) (token GithubAccessToken, err error)

获取accessToken

type GithubUser

type GithubUser struct {
	Id        int       `gorm:"not null;"json:"id"`        //用户id
	MemberId  int       `gorm:"not null;"json:"memberId"`  //绑定的用户id
	UpdatedAt time.Time `gorm:"not null;"json:"updatedAt"` //用户资料更新时间
	AvatarURL string    `gorm:"not null;"json:"avatarUrl"` //用户头像链接
	Email     string    `gorm:"not null;"json:"email"`     //电子邮箱
	Login     string    `gorm:"not null;"json:"login"`     //用户名
	Name      string    `gorm:"not null;"json:"name"`      //昵称
	HtmlURL   string    `gorm:"not null;"json:"htmlUrl"`   //github主页
}

GitHub 用户数据 用户使用GitHub登录的时候,直接根据GitHub的id获取数据

func GetGithubUserInfo

func GetGithubUserInfo(accessToken string) (info GithubUser, err error)

获取用户信息

type QQAccessToken

type QQAccessToken struct {
	AccessToken string `json:"access_token"`
}

qq accesstoken 数据

func GetQQAccessToken

func GetQQAccessToken(code string) (token QQAccessToken, err error)

获取accessToken

type QQUser

type QQUser struct {
	Ret       int    `json:"ret"`
	Msg       string `json:"msg"`
	AvatarURL string `json:"figureurl_qq_2"` //用户头像链接
	Name      string `json:"nickname"`       //昵称
	Gender    string `json:"gender"`         //性别
}

qq 用户数据 用户使用qq登录的时候,直接根据qq的id获取数据

func GetQQUserInfo

func GetQQUserInfo(accessToken, openid string) (info QQUser, err error)

获取用户信息

type SessKey

type SessKey struct {
	OpenId     string `json:"openid"`
	SessionKey string `json:"session_key"`
	UnionId    string `json:"unionid"`
	ErrCode    int    `json:"errcode"`
	ErrMsg     string
}

func GetWechatSessKey

func GetWechatSessKey(appId, secret, code string) (sess *SessKey, err error)

type WechatUser

type WechatUser struct {
	Openid    string `json:"openid"`
	Unionid   string `json:"unionid"`
	AvatarURL string `json:"avatarUrl"`
	City      string `json:"city"`
	Country   string `json:"country"`
	Gender    int    `json:"gender"`
	Language  string `json:"language"`
	NickName  string `json:"nickName"`
	Province  string `json:"province"`
}

Jump to

Keyboard shortcuts

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