oauth

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TokenURL is the URL from where access tokens for the Site24x7 API are
	// obtained.
	TokenURL = "https://accounts.zoho.com/oauth/v2/token"

	// TokenType is the type used in the Authorization header next to the
	// access token.
	TokenType = "Zoho-oauthtoken"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	*oauth2.Config

	// RefreshToken is a token that's used by the application
	// (as opposed to the user) to refresh the access token
	// if it expires.
	RefreshToken string
}

Config is an OAuth config that is also aware of the refresh token.

func NewConfig

func NewConfig(clientID, clientSecret, refreshToken string) *Config

NewConfig creates a new *Config for the provided client credentials.

func (*Config) Client

func (c *Config) Client(ctx context.Context) *http.Client

Client returns a *http.Client which automatically retrieves OAuth access tokens and attaches them to any request made with it.

func (*Config) TokenSource

func (c *Config) TokenSource(ctx context.Context) oauth2.TokenSource

TokenSource creates an oauth2.TokenSource which obtains access tokens using the refresh token.

Jump to

Keyboard shortcuts

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