oauth2

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2021 License: Apache-2.0 Imports: 9 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	ClientID     string   // client_id
	ClientSecret string   // client_secret
	EndPoint     EndPoint // endpoint
	Scopes       []string //scopes
	RerdirectUrl string
}

type EndPoint

type EndPoint struct {
	AuthURL  string
	TokenURL string
}

type Response

type Response struct {
	Status     string
	StatusCode int
	Header     http.Header
	Body       []byte
}

func (*Response) ReadAll

func (r *Response) ReadAll() []byte

ReadAll

func (*Response) ReadAllString

func (r *Response) ReadAllString() string

ReadAllString

type User

type User struct {
	Raw      *gjson.Json
	ID       string
	Name     string
	NickName string
	Avatar   string
	Email    string
}

User

func (*User) GetAccessToken

func (u *User) GetAccessToken() string

GetAccessToken

func (*User) GetAvatar added in v1.0.1

func (u *User) GetAvatar() string

GetAvatar

func (*User) GetEmail added in v1.0.1

func (u *User) GetEmail() string

GetEmail

func (*User) GetExpiresIn

func (u *User) GetExpiresIn() int

GetExpiresIn

func (*User) GetID added in v1.0.1

func (u *User) GetID() string

GetID

func (*User) GetName added in v1.0.1

func (u *User) GetName() string

GetName

func (*User) GetNickName added in v1.0.1

func (u *User) GetNickName() string

GetNickName

func (*User) GetRaw added in v1.0.1

func (u *User) GetRaw() *gjson.Json

GetRaw return *gjson.Json 具体用法查看 github.com/gogf/gf/encoding/gjson

func (*User) GetRefreshToken

func (u *User) GetRefreshToken() string

GetRefreshToken

func (*User) SetAccessToken

func (u *User) SetAccessToken(token string) *User

SetAccessToken

func (*User) SetExpiresIn

func (u *User) SetExpiresIn(expiresIn int) *User

SetExpiresIn

func (*User) SetRefreshToken

func (u *User) SetRefreshToken(token string) *User

SetRefreshTokne

type WechatConfig

type WechatConfig struct {
	RerdirectUrl   string
	State          string
	Scopes         []string
	ComponentID    string
	ComponentToken string

	Lang string
	// contains filtered or unexported fields
}

func Wechat

func Wechat(config Config, other ...map[string]string) *WechatConfig

Wechat

func (*WechatConfig) GetAuthURL

func (w *WechatConfig) GetAuthURL(redierct string, state ...string) string

GetAuthURL

func (*WechatConfig) GetTokenFromCode

func (w *WechatConfig) GetTokenFromCode(code string) (token *gjson.Json)

GetTokenFromCode

func (*WechatConfig) GetUserByToken

func (w *WechatConfig) GetUserByToken(token string) *User

GetUserFromToken

func (*WechatConfig) GetUserFromCode

func (w *WechatConfig) GetUserFromCode(code string) *User

GetUserFromCode

func (*WechatConfig) OpenPlatform

func (w *WechatConfig) OpenPlatform(componentID string, ComponentToken string) *WechatConfig

OpenPlatform 第三方平台的配置

func (*WechatConfig) Scope

func (w *WechatConfig) Scope(scopes []string) *WechatConfig

Scope

func (*WechatConfig) WithLang

func (w *WechatConfig) WithLang(lang string) *WechatConfig

WithLang

Jump to

Keyboard shortcuts

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