google

package
v0.0.0-...-1c0eac8 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2016 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// ScopeProfile allows the client to access the user's
	// profile info.
	ScopeProfile string = "profile"

	//ScopeEmail allows the cient to access the user's
	// email address.
	ScopeEmail string = "email"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

type Provider struct {
	IdentityURL string
	// contains filtered or unexported fields
}

Provider holds all the info for our Oauth2 provider.

func New

func New() *Provider

New returns a new provider. Some providers have their endpoints as part of the Oauth2 package, and Google is one of them.

func (*Provider) BuildAuthURL

func (p *Provider) BuildAuthURL(state string) string

BuildAuthURL builds the authentication endpoint that we redirect our users to.

func (*Provider) GetCodeURL

func (p *Provider) GetCodeURL(r *http.Request) string

GetCodeURL gets the short-lived access code from the callback URL that we can exchange for an access token.

func (*Provider) GetIdentity

func (p *Provider) GetIdentity(tok *oauth2.Token) (*id.User, error)

GetIdentity gets the client's identity from the provider.

func (*Provider) GetToken

func (p *Provider) GetToken(code string) (*oauth2.Token, error)

GetToken gets the access and refresh tokens from the provider.

Jump to

Keyboard shortcuts

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