googleclient

package
v0.0.7 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts Options) (*http.Client, error)

New returns a new http.Client suitable for passing to the New functions from the packages under google.golang.org/api/. An interactive OAuth flow is performed if the credentials don't exist in the config file. An attempt to be open a web browser will done if opts.OpenBrowser is true.

TODO(razvanm): add support for refresh tokens. TODO(razvanm): add support for Application Default Credentials.

Types

type Options

type Options struct {
	ClientID     string
	ClientSecret string

	// Scopes indicates what scope to request.
	Scopes []string

	// AccessType indicates what type of access is desireed. The two possible
	// options are oauth2.AccessTypeOnline and oauth2.AccessTypeOffline.
	AccessType oauth2.AuthCodeOption

	// ConfigFile indicates where to look for and save the credentials. On Linux
	// this is something like ~/.config/grail-role-group/credentials.json.
	ConfigFile string

	// OpenBrowser indicates that a browser should be open to obtain the proper
	// credentials if they are missing.
	OpenBrowser bool
}

Options describes various options that can be used to create the client.

Jump to

Keyboard shortcuts

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