Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CodeReceiver ¶
type CodeReceiver struct { State string *httptest.Server // contains filtered or unexported fields }
func NewCodeReceiver ¶
func NewCodeReceiver() (*CodeReceiver, error)
func (CodeReceiver) Code ¶
func (c CodeReceiver) Code() <-chan string
type Config ¶
type Config struct { // Required OAuth2Config *oauth2.Config // Required if TokenFile is empty Name string AuthCodeOptions []oauth2.AuthCodeOption // Defaults to <UserCacheDir>/<Name>/token.json TokenFile string }
Config encapsulates typical OAuth2 authorization flow:
- Try to restore previously-saved token,
- If not available, start a local server for receiving code and prompt its URL,
- Obtain an access token when code is received,
- Store the token for later use.
func (*Config) AuthorizeByTemporaryServer ¶
func (*Config) CreateOAuth2Client ¶
CreateOAuth2Client handles a typical authorization flow. See Config.
func (*Config) DeleteTokenFile ¶
Click to show internal directories.
Click to hide internal directories.