auth

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Aug 14, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// 开放平台授权 小程序 SessionKey
	MiniProgramSessionKeyCacheKey = "WeiXin:Container:Open:MiniProgramSessionKey:%s:%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Auth

type Auth struct {
	*openContext.Context
	// contains filtered or unexported fields
}

Auth 登录/用户信息

func NewAuth

func NewAuth(opContext *openContext.Context, appID string) *Auth

NewAuth new auth

func (*Auth) Code2Session

func (auth *Auth) Code2Session(ctx context.Context, jsCode string) (result ResCode2Session, err error)

Code2Session 登录凭证校验。

func (*Auth) GetDecryptData

func (auth *Auth) GetDecryptData(sessionKey, encryptedData, iv string) (*encryptor.PlainData, error)

func (*Auth) GetPaidUnionID

func (auth *Auth) GetPaidUnionID()

GetPaidUnionID 用户支付完成后,获取该用户的 UnionId,无需用户授权

func (*Auth) GetSessionKey

func (auth *Auth) GetSessionKey(ctx context.Context, openID string) (result string, err error)

GetSessionKey 登录SessionKey。

type MiniProgramSessionKey

type MiniProgramSessionKey struct {
	OpenId     string `json:"open_id"`
	UnionId    string `json:"union_id"`
	SessionKey string `json:"session_key"`
	ExpireTime int64  `json:"expire_time"`
}

MiniProgramSessionKey 小程序

type ResCode2Session

type ResCode2Session struct {
	util.CommonError
	OpenID     string `json:"openid"`      // 用户唯一标识
	SessionKey string `json:"session_key"` // 会话密钥
	UnionID    string `json:"unionid"`     // 用户在开放平台的唯一标识符,在满足UnionID下发条件的情况下会返回
}

ResCode2Session 登录凭证校验的返回结果

Jump to

Keyboard shortcuts

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