// AccessToken obtains an access token (token credential) by POSTing a
// request (with oauth_token and oauth_verifier in the auth header) to the
// Endpoint AccessTokenURL. Returns the access token and secret (token
// credentials). The extraParams parameter can be used to add extra
// parameters (in addition to the standard OAuth parameters) to the Auth header.
// See RFC 5849 2.3 Token Credentials.
AccessToken obtains an access token (token credential) by POSTing a
request (with oauth_token and oauth_verifier in the auth header) to the
Endpoint AccessTokenURL. Returns the access token and secret (token
credentials). The extraParams parameter can be used to add extra
parameters (in addition to the standard OAuth parameters) to the Auth header.
See RFC 5849 2.3 Token Credentials.
// AccessToken obtains an access token ( token credential ) by POSTing a // request ( with oauth_token and oauth_verifier in the auth header ) to the // Endpoint AccessTokenURL . Returns the access token and secret ( token // credentials ) . The extraParams parameter can be used to add extra // parameters ( in addition to the standard OAuth parameters ) to the Auth header . // See RFC 5849 2 . 3 Token Credentials .
func (c *Config) AccessToken(requestToken, requestSecret, verifier string) (token *Token, err error) {
	req, err := http.NewRequest("POST", c.Endpoint.AccessTokenURL, nil)
	if err != nil {
		return nil, err
	}
	err = newAuther(c).setAccessTokenAuthHeader(req, requestToken, requestSecret, verifier)
	if err != nil {
		return nil, err
	}
	values, err := c.handleTokenRequest(req)
	if err != nil {
		return nil, err
	}
	accessToken := values.Get(oauthTokenParam)
	accessSecret := values.Get(oauthTokenSecretParam)
	if accessToken == "" || accessSecret == "" {
		return nil, errors.New("oauth1: Response missing oauth_token or oauth_token_secret")
	}
	return &Token{
		Token:          accessToken,
		TokenSecret:    accessSecret,
		AdditionalData: parseAdditionalTokenDataFromAccessTokenResponse(values),
		Realm:          c.Realm,
	}, nil
}
func ( c * Config ) AccessToken ( requestToken , requestSecret , verifier string ) ( token * Token , err error ) { req , err := http . NewRequest ( " " , c . Endpoint . AccessTokenURL , nil ) if err != nil { return nil , err } err = newAuther ( c ) . setAccessTokenAuthHeader ( req , requestToken , requestSecret , verifier ) if err != nil { return nil , err } values , err := c . handleTokenRequest ( req ) if err != nil { return nil , err } accessToken := values . Get ( oauthTokenParam ) accessSecret := values . Get ( oauthTokenSecretParam ) if accessToken == " " || accessSecret == " " { return nil , errors . New ( " " ) } return & Token { Token : accessToken , TokenSecret : accessSecret , AdditionalData : parseAdditionalTokenDataFromAccessTokenResponse ( values ) , Realm : c . Realm , } , nil }
AccessToken obtains an access token (token credential) by POSTing a
request (with oauth_token and oauth_verifier in the auth header) to the
Endpoint AccessTokenURL.
AccessToken obtains an access token ( token credential ) by POSTing a request ( with oauth_token and oauth_verifier in the auth header ) to the Endpoint AccessTokenURL .