oauth

package
v0.0.9 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2023 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessToken

type AccessToken struct {
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	ExpiresIn    int    `json:"expires_in"`
}

type BaseUserInfo

type BaseUserInfo struct {
	OpenID  string `json:"openid"`
	UnionID string `json:"unionid"`
}

type OAuth

type OAuth struct {
	// contains filtered or unexported fields
}

OAuth App用户授权

func New

func New(account contracts.AccountInterface, opts ...Option) *OAuth

func (*OAuth) LoginCodeAccessToken

func (oauth *OAuth) LoginCodeAccessToken(code string) (*BaseUserInfo, error)

LoginCodeAccessToken 用户登录授权code换取access_token

func (*OAuth) UserInfo

func (oauth *OAuth) UserInfo(openid string) (*UserInfo, error)

UserInfo 获取用户信息

type Option

type Option func(auth *OAuth)

func WithLocker

func WithLocker(locker lock.Locker) Option

WithLocker 设置锁

type UserInfo

type UserInfo struct {
	BaseUserInfo
	Nickname   string `json:"nickname"`
	HeadImgUrl string `json:"headimgurl"`
	Sex        uint8  `json:"sex"`
	Province   string `json:"province"`
	City       string `json:"city"`
	Country    string `json:"country"`
}

Jump to

Keyboard shortcuts

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