oauth2

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Feb 29, 2024 License: MIT Imports: 6 Imported by: 0

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 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"`
}

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