oauth

package
v2.0.3+incompatible Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2016 License: MIT Imports: 12 Imported by: 16

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	ID           string
	Secret       string
	RedirectURL  string
	ExtraHeaders map[string]string
}

Client represents a client for the OAuth 2.0 flow

type Config

type Config struct {
	Server string
	Client *Client
	// contains filtered or unexported fields
}

func OAuth

func OAuth(server string, client *Client) *Config

OAuth creates a new 3-legged OAuth client

func OAuthWithCache

func OAuthWithCache(server string, client *Client, cache cache.Cache) *Config

OAuth creates a new 3-legged OAuth client that uses a cache to cache token exchanges

func (*Config) AuthCodeURL

func (o *Config) AuthCodeURL(state string, opts ...oauth2.AuthCodeOption) string

AuthCodeURL returns a URL to OAuth 2.0 provider's consent page that asks for permissions for the required scopes explicitly.

func (*Config) Exchange

func (o *Config) Exchange(code string) (*oauth2.Token, error)

Exchange exchanges an OAuth 2.0 Authorization Code for an oauth2.Token

func (*Config) ExchangeAppKeyForToken

func (o *Config) ExchangeAppKeyForToken(appID, accessKey string) (*oauth2.Token, error)

ExchangeAppKeyForToken exchanges an application Access Key for an equivalent

func (*Config) ExchangeGatewayKeyForToken

func (o *Config) ExchangeGatewayKeyForToken(gatewayID, gatewayKey string) (*oauth2.Token, error)

ExchangeGatewayKeyForToken exchanges an application Access Key for an equivalent

func (*Config) PasswordCredentialsToken

func (o *Config) PasswordCredentialsToken(username, password string) (*oauth2.Token, error)

PasswordCredentialsToken gets an oauth2.Token from username and password

func (*Config) TokenSource

func (o *Config) TokenSource(token *oauth2.Token) oauth2.TokenSource

TokenSource creates oauth2.TokenSource from an oauht2.Token

type OAuthError

type OAuthError struct {
	Code        int    `json:"code"`
	Description string `json:"description"`
}

func (*OAuthError) Error

func (e *OAuthError) Error() string

Jump to

Keyboard shortcuts

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