Documentation ¶
Overview ¶
package oath1 provides HTTP handlers specific to OAuth1-related workflows.
Index ¶
- func NewAuthorizationTokenHandler(opts *AuthorizationTokenHandlerOptions) (gohttp.Handler, error)
- func NewAuthorizationTokenHandlerWithChannels(token_ch chan auth.AuthorizationToken, err_ch chan error) (gohttp.Handler, error)
- func NewRequestTokenHandler(opts *RequestTokenHandlerOptions) (gohttp.Handler, error)
- type AuthorizationTokenHandlerOptions
- type AuthorizationVars
- type RequestTokenCache
- type RequestTokenHandlerOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewAuthorizationTokenHandler ¶
func NewAuthorizationTokenHandler(opts *AuthorizationTokenHandlerOptions) (gohttp.Handler, error)
Return a new HTTP handler to receive a process OAuth1 authorization callback requests. This handler will retrieve the request token associated with the authorization request and exchange these elements for a permanent OAuth1 access token.
func NewAuthorizationTokenHandlerWithChannels ¶
func NewAuthorizationTokenHandlerWithChannels(token_ch chan auth.AuthorizationToken, err_ch chan error) (gohttp.Handler, error)
Return a new HTTP handler to receive a process OAuth1 authorization callback requests. This handler will relay the OAuth1 authorization token or any errors received by the callback to the appropriate channel. This handler is used to create a background HTTP server process that can block execution of a command-line OAuth1 authorization "www" flow until either a token or an error is dispatched to its corresponding channel in the application code.
func NewRequestTokenHandler ¶
func NewRequestTokenHandler(opts *RequestTokenHandlerOptions) (gohttp.Handler, error)
Return a new HTTP handler to create a new OAuth1 authorization request token and then redirect to the Flickr API OAuth1 authorization approval endpoint.
Types ¶
type AuthorizationTokenHandlerOptions ¶
type AuthorizationTokenHandlerOptions struct { // A client.Client instance used to call the Flickr API Client client.Client // A gocloud.dev/docstore.Collection instance used to retrieve request token details necessary for creating permanent access tokens. Collection *docstore.Collection }
AuthorizationTokenHandlerOptions is a struct containing application-specific details necessary for all OAuth1 authorization callback requests.
type AuthorizationVars ¶
type AuthorizationVars struct { Error error User *response.User AccessToken auth.AccessToken }
type RequestTokenCache ¶
type RequestTokenCache struct { // Flickr API OAuth1 request token. Token string // Flickr API OAuth1 request token secret. Secret string // Unix timestamp representing the time that the RequestTokenCache was created. Created int64 }
RequestTokenCache is a struct containing OAuth1 request token details and a timestamp indicating when the token details were created. This information is used to persist request token information, specifically the request token secret, before and after the approval phase of an OAuth1 authorization "www" flow.
func NewRequestTokenCache ¶
func NewRequestTokenCache(req_token auth.RequestToken) (*RequestTokenCache, error)
Create a new RequestTokenCache instance from a auth.RequestToken instance.
type RequestTokenHandlerOptions ¶
type RequestTokenHandlerOptions struct { // A client.Client instance used to call the Flickr API Client client.Client // A gocloud.dev/docstore.Collection instance used to store request token details necessary for creating permanent access tokens. Collection *docstore.Collection // The Flickr API permissions that your application is requesting. Permissions string // The fully qualified callback URL to be invoked by Flickr if an autorization request is approved. AuthCallback string }
RequestTokenHandlerOptions is a struct containing application-specific details necessary for all OAuth1 authorization flow requests.