token

package
Version: v0.0.0-...-2d87196 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2021 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package token provides utilities for caching Gmail auth token. TOOD(bzz) rename to auth?

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromContext

func FromContext(ctx context.Context) (*oauth2.Token, bool)

FromContext returnes the token, saved from the cookies, if any.

func FromFile

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

FromFile retrieves a token from a local file.

func FromWeb

func FromWeb(config *oauth2.Config) *oauth2.Token

FromWeb request a token from the web, then returns the retrieved token.

func LabelFromContext

func LabelFromContext(ctx context.Context) (string, bool)

LabelFromContext returnes the label, saved from the cookies, if any.

func NewLabelContext

func NewLabelContext(parent context.Context, cookies []*http.Cookie) context.Context

NewLabelContext reads label cookie, returnes context with the label set to it, if any.

func NewLabelCookie

func NewLabelCookie(label string) *http.Cookie

NewLabelCookie returns a new cookie with the token set.

func NewSessionContext

func NewSessionContext(parent context.Context, cookies []*http.Cookie) context.Context

NewSessionContext reads session cookie, returnes context with the token set to it, if any.

func NewSessionCookie

func NewSessionCookie(token *oauth2.Token) *http.Cookie

NewSessionCookie returns a new cookie with the token set.

func Save

func Save(path string, token *oauth2.Token)

Save saves the token to a file path.

Types

This section is empty.

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL