oauth

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2026 License: MIT Imports: 9 Imported by: 0

README

用户授权

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccessTokenResponse

type AccessTokenResponse struct {
	kernelError.ApiError
	AccessToken  string `json:"access_token"`
	ExpiresIn    int64  `json:"expires_in"`
	RefreshToken string `json:"refresh_token"`
	Openid       string `json:"openid"`
	Scope        string `json:"scope"`
	UnionID      string `json:"unionid"`
}

type OAuth

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

OAuth 公众号用户授权

func New

func New(account contracts.AccountInterface) *OAuth

func (*OAuth) AuthUrl

func (auth *OAuth) AuthUrl() string

func (*OAuth) Redirect

func (auth *OAuth) Redirect(writer http.ResponseWriter, request *http.Request)

func (*OAuth) TokenFromCode

func (auth *OAuth) TokenFromCode(code string) (*AccessTokenResponse, error)

func (*OAuth) UserFromCode

func (auth *OAuth) UserFromCode(code string) (*user.User, error)

func (*OAuth) WithRedirectUrl

func (auth *OAuth) WithRedirectUrl(redirectUrl string) *OAuth

func (*OAuth) WithScope

func (auth *OAuth) WithScope(scope string) *OAuth

func (*OAuth) WithState

func (auth *OAuth) WithState(state string) *OAuth

Jump to

Keyboard shortcuts

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