oauth2

package
v0.71.2 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: MIT Imports: 6 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

View Source
const (
	AuthTokenUrl  = "https://accounts.google.com/o/oauth2/token"
	TokenCheckUrl = "https://www.googleapis.com/oauth2/v3/tokeninfo?access_token=%s"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type GoogleAuthError added in v0.54.11

type GoogleAuthError struct {
	ErrorCode        string
	ErrorDescription string
}

GoogleAuthError represents an OAuth error response from Google.

func (*GoogleAuthError) Error added in v0.54.11

func (e *GoogleAuthError) Error() string

type GoogleAuthRequest

type GoogleAuthRequest struct {
	ClientId     string
	ClientSecret string
	GrantType    string
	RefreshToken string
}

type GoogleAuthResponse

type GoogleAuthResponse struct {
	AccessToken      string `json:"access_token"`
	ExpiresIn        uint   `json:"expires_in"`
	TokenType        string `json:"token_type"`
	Error            string `json:"error"`
	ErrorDescription string `json:"error_description"`
}

type GoogleService

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

func (*GoogleService) GetAuthRefresh

func (service *GoogleService) GetAuthRefresh(ctx context.Context, authRequest *GoogleAuthRequest) (*GoogleAuthResponse, error)

func (*GoogleService) TokenInfo

func (service *GoogleService) TokenInfo(ctx context.Context, accessToken string) (*GoogleTokenInfoResponse, error)

type GoogleTokenInfoResponse

type GoogleTokenInfoResponse struct {
	AccessType string `json:"access_type"`
	Aud        string `json:"aud"`
	Azp        string `json:"azp"`
	Exp        string `json:"exp"`
	ExpiresIn  string `json:"expires_in"`
	Scope      string `json:"scope"`
}

type Service

type Service interface {
	GetAuthRefresh(ctx context.Context, authRequest *GoogleAuthRequest) (*GoogleAuthResponse, error)
	TokenInfo(ctx context.Context, accessToken string) (*GoogleTokenInfoResponse, error)
}

func NewGoogleService

func NewGoogleService(ctx context.Context, config cfg.Config, logger log.Logger) (Service, error)

func NewGoogleServiceWithInterfaces

func NewGoogleServiceWithInterfaces(httpClient http.Client) Service

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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