token

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: Apache-2.0 Imports: 14 Imported by: 20

Documentation

Overview

Package token 基于 golang.org/x/oauth2 标准实现token source

Index

Constants

View Source
const (
	// TypeBearer ..
	TypeBearer string = "Bearer"
	// TypeQQBot ..
	TypeQQBot string = "QQBot"
)

Variables

This section is empty.

Functions

func NewQQBotTokenSource added in v0.1.7

func NewQQBotTokenSource(credentials *QQBotCredentials) oauth2.TokenSource

NewQQBotTokenSource 初始化

func StartRefreshAccessToken added in v0.1.7

func StartRefreshAccessToken(ctx context.Context, tokenSource oauth2.TokenSource) error

StartRefreshAccessToken 启动获取AccessToken的后台刷新

Types

type QQBotCredentials added in v0.1.7

type QQBotCredentials struct {
	AppID     string `yaml:"appid"`
	AppSecret string `yaml:"secret"`
}

QQBotCredentials QQ机器人appid、secret

type QQBotTokenSource added in v0.1.7

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

QQBotTokenSource QQ机器人token source

func (*QQBotTokenSource) GetAppID added in v0.1.7

func (w *QQBotTokenSource) GetAppID() string

GetAppID 获取appid

func (*QQBotTokenSource) Token added in v0.1.7

func (w *QQBotTokenSource) Token() (*oauth2.Token, error)

Token 获取access token

Jump to

Keyboard shortcuts

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