Documentation ¶
Overview ¶
Package oauth implements a oAuth 1.0a client.
Index ¶
- Variables
- func Base(method string, url string, values url.Values) string
- func Sign(base string, clientSecret string, tokenSecret string) string
- type Consumer
- func (c *Consumer) Authorization() (string, *Token, error)
- func (c *Consumer) Clone(ctx httpclient.Context) *Consumer
- func (c *Consumer) Exchange(token *Token, verifier string) (*Token, error)
- func (c *Consumer) Get(url string, values url.Values, token *Token) (*httpclient.Response, error)
- func (c *Consumer) Post(url string, values url.Values, token *Token) (*httpclient.Response, error)
- func (c *Consumer) Request(method string, url string, values url.Values, token *Token) (*http.Request, error)
- func (c *Consumer) SendRequest(method string, url string, values url.Values, token *Token) (*httpclient.Response, error)
- type Token
Constants ¶
This section is empty.
Variables ¶
var (
NoRedirectAllowedError = errors.New("redirects not allowed with oAuth")
)
Functions ¶
Types ¶
type Consumer ¶
type Consumer struct { Key string Secret string Service string RequestTokenURL string AccessTokenURL string AuthorizationURL string CallbackURL string Client *httpclient.Client // contains filtered or unexported fields }
func (*Consumer) Authorization ¶
Authorization requests a Request Token and returns the URL the user should visit to authorize it as well as the token, which needs to be used later for exchanging it for an Access Token.
func (*Consumer) Exchange ¶
Exchange exchanges a Request Token for an Access Token using the given verifier. The verifier is sent by the provider to the consumer at the callback URL. If the provider you're using doesn't require a verifier, just pass an empty string.
func (*Consumer) Get ¶
Get performs a GET request to the given URL with the given values and signed with the consumer and the given token (if any). The url parameter can't contain a query string. All url parameters should be passed using the values parameter.
func (*Consumer) Post ¶
Post performs a POST request to the given URL with the given values and signed with the given token (if any).