threeleg

package
v0.0.0-...-e9ebf91 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2018 License: BSD-3-Clause Imports: 9 Imported by: 1

Documentation

Overview

Package threeleg provides functions for working with the three-legged OAuth flow described at https://developer.lyft.com/v1/docs/authentication#section-3-legged-flow-for-accessing-user-specific-endpoints.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthorizationCode

func AuthorizationCode(r *http.Request) string

AuthorizationCode retrieves the authorization code sent in the authorization redirect request from Lyft. If ReadForm hasn't been called on the request already, it will be called during the process.

func AuthorizationURL

func AuthorizationURL(clientID string, scopes []string, state string) string

AuthorizationURL constructs the URL that a user should be directed to, in order for the user to grant the list of permissions your application is requesting.

func RevokeToken

func RevokeToken(c *http.Client, baseURL, clientID, clientSecret, accessToken string) (http.Header, error)

RevokeToken revokes the supplied access token. baseURL is typically lyft.BaseURL.

Types

type RefreshedToken

type RefreshedToken struct {
	AccessToken string
	TokenType   string
	Expires     time.Duration
	Scopes      []string
}

RefreshedToken is returned by RefreshToken.

func RefreshToken

func RefreshToken(c *http.Client, baseURL, clientID, clientSecret, refreshToken string) (RefreshedToken, http.Header, error)

RefreshToken refreshes the access token associated with refreshToken. See Token for obtaining access/refresh token pairs. baseURL is typically lyft.BaseURL.

type Token

type Token struct {
	AccessToken  string
	RefreshToken string
	TokenType    string
	Expires      time.Duration
	Scopes       []string
}

Token is returned by GenerateToken.

func GenerateToken

func GenerateToken(c *http.Client, baseURL, clientID, clientSecret, code string) (Token, http.Header, error)

GenerateToken creates a new access token using the authorization code obtained from Lyft's authorization redirect. The access token returned can be used in lyft.Client. baseURL is typically lyft.BaseURL.

Jump to

Keyboard shortcuts

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