Documentation ¶
Overview ¶
Package tokens defines queries to obtain and authorize access tokens for the Twitter API.
Index ¶
Constants ¶
const UsePIN = "oob"
UsePIN is used as the callback in an authorization ticket request to request "out-of-band" or PIN based verification.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AccessOpts ¶
type AccessOpts struct{}
AccessOpts provides optional values for an access-token request. A nil *AccessOpts provides empty values for all fields.
type AccessQuery ¶
An AccessQuery is a query for an access token.
func GetAccess ¶
func GetAccess(c auth.Config, reqToken, verifier string, opts *AccessOpts) AccessQuery
GetAccess constructs a query to obtain an access token from the given request token and verifier.
This query does not require c.AccessToken or c.AccessTokenSecret.
API: oauth/access_token
func (AccessQuery) Invoke ¶
func (a AccessQuery) Invoke(ctx context.Context, cli *twitter.Client) (AccessToken, error)
Invoke issues the query and returns the access Token.
type AccessToken ¶
An AccessToken is a Token with optional user identification data.
type BearerOpts ¶
type BearerOpts struct{}
BearerOpts provides optional values for a bearer-token request. A nil *BearerOpts provides empty values for all fields.
type BearerQuery ¶
A BearerQuery is a query for an OAuth 2 bearer token.
func GetBearer ¶
func GetBearer(c auth.Config, opts *BearerOpts) BearerQuery
GetBearer constructs a query to obtain an OAuth2 bearer token.
Bearer token requests are authenticated using c.APIKey and c.APISecret. This query does not require c.AccessToken or c.AccessTokenSecret.
API: oauth2/token
type InvalidateQuery ¶
InvalidateQuery is a query for a token invalidation request.
func InvalidateAccess ¶
func InvalidateAccess(c auth.Config, token, secret string) InvalidateQuery
InvalidateAccess constructs a query to invalidate an access token. This query does not use c.AccessToken or c.AccessTokenSecret.
API: oauth/invalidate_token
func InvalidateBearer ¶
func InvalidateBearer(c auth.Config, bearerToken string) InvalidateQuery
InvalidateBearer constructs a query to invalidate a bearer token.
This query requires c.AccessToken and c.AccessTokenSecret to be the access token of the owner of the bearer token.
API: oauth2/invalidate_token
type RequestOpts ¶
type RequestOpts struct {
AccessType string // access override; "read" or "write"
}
RequestOpts provides optional values for a ticket-granting request. A nil *RequestOpts provides empty values for all fields.
type RequestQuery ¶
A RequestQuery is a query for an authorization ticket.
func GetRequest ¶
func GetRequest(c auth.Config, callback string, opts *RequestOpts) RequestQuery
GetRequest constructs a query to obtain an authorization request ticket for the specified callback URL. Pass UsePIN for the callback to use PIN based verification.
This query requires c.AccessToken and c.AccessTokenSecret to be set to the application's own credentials.
API: oauth/request_token