Documentation ¶
Overview ¶
Package oauth only oAuth 1.0
Index ¶
- Constants
- type AccessToken
- type OAuth
- func (o *OAuth) BuildClient(accessToken *AccessToken) *http.Client
- func (o *OAuth) GetAccessToken(ctx context.Context, token RequestToken, verificationCode string, ...) (*AccessToken, error)
- func (o *OAuth) GetAuthorizationURL(token *RequestToken) (string, error)
- func (o *OAuth) GetRequestToken(ctx context.Context) (*RequestToken, error)
- type RequestToken
- type RoundTripper
- type ServiceProvider
Constants ¶
View Source
const ( OAUTH_VERSION = "1.0" HTTP_AUTH_HEADER = "Authorization" OAUTH_HEADER = "OAuth " BODY_HASH_PARAM = "oauth_body_hash" CALLBACK_PARAM = "oauth_callback" CONSUMER_KEY_PARAM = "oauth_consumer_key" NONCE_PARAM = "oauth_nonce" SESSION_HANDLE_PARAM = "oauth_session_handle" SIGNATURE_METHOD_PARAM = "oauth_signature_method" SIGNATURE_PARAM = "oauth_signature" TIMESTAMP_PARAM = "oauth_timestamp" TOKEN_PARAM = "oauth_token" TOKEN_SECRET_PARAM = "oauth_token_secret" VERIFIER_PARAM = "oauth_verifier" VERSION_PARAM = "oauth_version" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OAuth ¶
type OAuth struct { ServiceProvider *ServiceProvider // contains filtered or unexported fields }
OAuth OAuth
func NewOAuth ¶
func NewOAuth(consumerKey, consumerSecret string, serviceProvider ServiceProvider) *OAuth
NewOAuth NewOAuth
func NewOAuthWithClient ¶
func NewOAuthWithClient(consumerKey, consumerSecret string, serviceProvider ServiceProvider, client *http.Client) *OAuth
NewOAuthWithClient NewOAuthWithClient
func (*OAuth) BuildClient ¶
func (o *OAuth) BuildClient(accessToken *AccessToken) *http.Client
BuildClient build client with oauth
func (*OAuth) GetAccessToken ¶
func (o *OAuth) GetAccessToken(ctx context.Context, token RequestToken, verificationCode string, additionalParams map[string]string) (*AccessToken, error)
GetAccessToken token 只是授权此 requestToken,需要用此 token 换取 AccessToken
func (*OAuth) GetAuthorizationURL ¶
func (o *OAuth) GetAuthorizationURL(token *RequestToken) (string, error)
GetAuthorizationURL 请求用户授权Request Token
func (*OAuth) GetRequestToken ¶
func (o *OAuth) GetRequestToken(ctx context.Context) (*RequestToken, error)
GetRequestToken 获取未授权的Request Token
type RequestToken ¶
RequestToken RequestToken
type RoundTripper ¶
type RoundTripper struct {
// contains filtered or unexported fields
}
RoundTripper Custom RoundTripper
Click to show internal directories.
Click to hide internal directories.