Hi, I am using libtwitcurl, and converting oAuth to xAuth, but I got "Failed to validate oauth signature and token". I compare all I can printf data to libQtweet(xauth succesful), and couldn't found any error....
sigBase is: POST&https%3A%2F%2Fapi.twitter.com%2Foauth %2Faccess_token&oauth_consumer_key%3D**************%26oauth_nonce %3D1288319703364%26oauth_signature_method%3DHMAC-SHA1%26oauth_timestamp %3D1288319703%26oauth_version%3D1.0 oAuthHttpHeader is: Authorization: OAuth oauth_consumer_key="*************",oauth_nonce="1288319703364",oauth_signature="SUlWtiHEc6wZJwiY9bZDgRkSyKE %3D",oauth_signature_method="HMAC- SHA1",oauth_timestamp="1288319703",oauth_version="1.0" This is my code: bool twitCurl::xAuthAccessToken() { bool retVal = false; FILE *fp = fopen("/tmp/twitter/xauth","w"); std::string url(oAuthTwitterApiUrls::OAUTHLIB_TWITTER_ACCESS_TOKEN_URL); if( isCurlInit() ) { std::string body = "x_auth_mode=client_auth&x_auth_password=" + urlencode(m_twitterPassword) + "&x_auth_username=" + urlencode(m_twitterUsername); std::string dataStr(""); dataStr = body; url += (std::string("?") + body); std::string oAuthHeader( "" ); struct curl_slist* pOAuthHeaderList = NULL; CURL* curlHandle = curl_easy_init();; std::string localUrl = url; size_t nPos = url.find_first_of( "?" ); if( std::string::npos != nPos ) { localUrl = url.substr( 0, nPos ); } dataStr = urlencode( dataStr ); std::string oAuthHttpHeader(""); /* Set OAuth header */ m_oAuth.getOAuthHeader( eOAuthHttpPost, localUrl, dataStr, oAuthHttpHeader ); if( oAuthHttpHeader.length() > 0 ) { pOAuthHeaderList = curl_slist_append( pOAuthHeaderList, oAuthHttpHeader.c_str() ); if( pOAuthHeaderList ) { curl_easy_setopt( curlHandle, CURLOPT_HTTPHEADER, pOAuthHeaderList ); } } /* Set http request, url and data */ curl_easy_setopt( curlHandle, CURLOPT_POST, 1 ); curl_easy_setopt( curlHandle, CURLOPT_USE_SSL, CURLUSESSL_CONTROL); curl_easy_setopt( curlHandle, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3); curl_easy_setopt( curlHandle, CURLOPT_SSL_VERIFYPEER, 0L); curl_easy_setopt( curlHandle, CURLOPT_SSL_VERIFYHOST, 0L); curl_easy_setopt( curlHandle, CURLOPT_URL, url.c_str() ); curl_easy_setopt( curlHandle, CURLOPT_WRITEFUNCTION, write_data ); curl_easy_setopt( curlHandle, CURLOPT_WRITEDATA, fp ); if( dataStr.length() ) { curl_easy_setopt( curlHandle, CURLOPT_COPYPOSTFIELDS, dataStr.c_str() ); } /* Send http request */ CURLcode code = curl_easy_perform( curlHandle ); if( code == CURLE_OK ) { retVal = true; } else { retVal = false; } if( pOAuthHeaderList ) { curl_slist_free_all( pOAuthHeaderList ); } fclose(fp); } return retVal; } Thanks. -- Twitter developer documentation and resources: http://dev.twitter.com/doc API updates via Twitter: http://twitter.com/twitterapi Issues/Enhancements Tracker: http://code.google.com/p/twitter-api/issues/list Change your membership to this group: http://groups.google.com/group/twitter-development-talk