oauthhelper

package
v0.0.0-...-5ce0243 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 6 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadTokenFromFile

func LoadTokenFromFile(file string) (*oauth2.Token, error)

func StoreTokenToFile

func StoreTokenToFile(file string, token *oauth2.Token) error

Types

type Auth

type Auth struct {
	// Token holds the token that should be used for authentication (optional)
	// if the token is nil the callback func Authenticate will be called and after Authorization this token will be set
	// Store (and restore prior use) this token to avoid further authorization calls
	Token *oauth2.Token
	// ClientID  from https://console.developers.google.com/project/<your-project-id>/apiui/credential
	ClientID string
	// ClientSecret  from https://console.developers.google.com/project/<your-project-id>/apiui/credential
	ClientSecret string
	Authenticate AuthenticateFunc
}

func (*Auth) NewHTTPClient

func (auth *Auth) NewHTTPClient(ctx context.Context, userScopes ...string) (*http.Client, error)

type AuthenticateFunc

type AuthenticateFunc func(url string) (code string, err error)

Jump to

Keyboard shortcuts

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