oauth2

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Overview

Package oauth2 contains helper functions for provisioning OAuth2 tokens.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	// Token is the OAuth2 access token.
	TokenCode string `mapstructure:"token"`

	// TokenFile is the file containing the OAuth2 access token.
	TokenFile string `mapstructure:"token_file"`

	// NoWizard disables the token wizard.
	NoWizard bool `mapstructure:"no_wizard"`

	// Reader for prompting the user (defaults to stdin).
	Reader io.Reader `mapstructure:"-"`

	// Writer for prompting the user (defaults to stdout).
	Writer io.Writer `mapstructure:"-"`
}

Config is the basis for storage configurations that require an OAuth2 token.

func (*Config) Token

func (auth *Config) Token(config *oauth2.Config) (token *oauth2.Token, err error)

Token returns the OAuth2 token.

func (*Config) Wizard

func (auth *Config) Wizard(config *oauth2.Config, w io.Writer, r io.Reader) (token *oauth2.Token, err error)

Wizard prompts the user to visit a URL and returns the resulting OAuth2 token.

Jump to

Keyboard shortcuts

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