// RequestToken obtains a Request token and secret (temporary credential) by
// POSTing a request (with oauth_callback in the auth header) to the Endpoint
// RequestTokenURL. The response body form is validated to ensure
// oauth_callback_confirmed is true. Returns the request token and secret
// (temporary 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.1 Temporary Credentials.
RequestToken obtains a Request token and secret (temporary credential) by
POSTing a request (with oauth_callback in the auth header) to the Endpoint
RequestTokenURL. The response body form is validated to ensure
oauth_callback_confirmed is true. Returns the request token and secret
(temporary 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.1 Temporary Credentials.
// RequestToken obtains a Request token and secret ( temporary credential ) by // POSTing a request ( with oauth_callback in the auth header ) to the Endpoint // RequestTokenURL . The response body form is validated to ensure // oauth_callback_confirmed is true . Returns the request token and secret // ( temporary 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 . 1 Temporary Credentials .
func (c *Config) RequestToken() (requestToken, requestSecret string, err error) {
	req, err := http.NewRequest("POST", c.Endpoint.RequestTokenURL, nil)
	if err != nil {
		return "", "", err
	}
	err = newAuther(c).setRequestTokenAuthHeader(req)
	if err != nil {
		return "", "", err
	}
	values, err := c.handleTokenRequest(req)
	if err != nil {
		return "", "", err
	}
	requestToken = values.Get(oauthTokenParam)
	requestSecret = values.Get(oauthTokenSecretParam)
	if requestToken == "" || requestSecret == "" {
		return "", "", errors.New("oauth1: Response missing oauth_token or oauth_token_secret")
	}
	if values.Get(oauthCallbackConfirmedParam) != "true" {
		return "", "", errors.New("oauth1: oauth_callback_confirmed was not true")
	}
	return requestToken, requestSecret, nil
}
func ( c * Config ) RequestToken ( ) ( requestToken , requestSecret string , err error ) { req , err := http . NewRequest ( " " , c . Endpoint . RequestTokenURL , nil ) if err != nil { return " " , " " , err } err = newAuther ( c ) . setRequestTokenAuthHeader ( req ) if err != nil { return " " , " " , err } values , err := c . handleTokenRequest ( req ) if err != nil { return " " , " " , err } requestToken = values . Get ( oauthTokenParam ) requestSecret = values . Get ( oauthTokenSecretParam ) if requestToken == " " || requestSecret == " " { return " " , " " , errors . New ( " " ) } if values . Get ( oauthCallbackConfirmedParam ) != " " { return " " , " " , errors . New ( " " ) } return requestToken , requestSecret , nil }
RequestToken obtains a Request token and secret (temporary credential) by
POSTing a request (with oauth_callback in the auth header) to the Endpoint
RequestTokenURL.
RequestToken obtains a Request token and secret ( temporary credential ) by POSTing a request ( with oauth_callback in the auth header ) to the Endpoint RequestTokenURL .