auth

package
v0.0.0-...-941dbc7 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2020 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Scopes = []string{
	drive.DriveScope,
	gmail.GmailMetadataScope,
	gmail.GmailSendScope,
}

Scopes needed for API

Functions

func SaveToken

func SaveToken(path string, token *oauth2.Token) error

SaveToken saves a token to a file path.

Types

type Client

type Client struct {
	*http.Client
	Token *oauth2.Token

	Email string
}

type Config

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

func GetConfig

func GetConfig(clientID, clientSecret, redirectURL string) *Config

func (*Config) AuthCodeURL

func (cfg *Config) AuthCodeURL(state string) string

func (*Config) ClientFromCode

func (cfg *Config) ClientFromCode(code string) (*Client, error)

ClientFromCode returns auth client from code

func (*Config) ClientFromToken

func (cfg *Config) ClientFromToken(tok *oauth2.Token) (*Client, error)

ClientFromToken return auth client from token

func (*Config) ClientFromTokenFile

func (cfg *Config) ClientFromTokenFile(path string) (*Client, error)

ClientFromTokenFile return auth token from token file

Jump to

Keyboard shortcuts

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