Re: [twitter-dev] Oauth problems?

4 views
Skip to first unread message

Tom van der Woerdt

unread,
Sep 10, 2010, 5:57:06 PM9/10/10
to twitter-deve...@googlegroups.com
You should encode the values in the Authorization: header.

Tom


On 9/10/10 11:50 PM, MTCoder wrote:
> i have written code (working code for a client app) up to the point of
> posting/reading to a twitter timeline.
> The user has allowed my app access and i have the token and token
> secret.
> Also i have double checked the signature and everything else and they
> all seem correct ( http://hueniverse.com/2008/10/beginners-guide-to-oauth-part-iv-signing-requests/
> is a awesome for this).
>
> Now my problem:
> whenever i call to get the timeline or post a new status to the
> timeline i get the return of
> "Status: 500 Internal Server Error" in the response header and the
> body is an html page saying "Something is technically wrong."
>
> So is them my problem or Twitters?
>
> base string:
> GET&http%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses
> %2Fhome_timeline.xml&oauth_consumer_key%3DKKKKKKKKKKKKK%26oauth_nonce
> %3D4E3431495445554D4E413D344E44443D%26oauth_signature_method%3DHMAC-
> SHA1%26oauth_timestamp%3D1284154584%26oauth_token%3DTTTTTTTTTTTTTTTT
> %26oauth_version%3D1.0
>
>
>
> my request:
>
> GET /1/statuses/home_timeline.xml HTTP/1.1
> Authorization: OAuth realm="",
> oauth_nonce="4E3431495445554D4E413D344E44443D",
> oauth_signature_method="HMAC-SHA1", oauth_timestamp="1284154584",
> oauth_consumer_key="KKKKKKKKKKKKK", oauth_token="TTTTTTTTTTTTTTTT",
> oauth_signature="zd8hazoYu5azlVDhnJ8/mr1jkwk=", oauth_version="1.0"
>
> also, im using the Chilkat HTTP lib on this one, in C++:
>
> CkHttp http;
> CkHttpRequest req;
> CkString header;
>
> sig = CreateOauthSig(base_string);
>
> // Build an HTTP POST Request:http://twitter.com/statuses/update.xml
> req.UseGet();
> req.put_Path("/1/statuses/home_timeline.xml");
>
> //build the header
> header.append("OAuth realm=\"\", oauth_nonce=\"");
> header.appendStr(nonce);
> header.append("\", oauth_signature_method=\"HMAC-SHA1\",
> oauth_timestamp=\"");
> header.appendStr(time_str);
> header.append("\", oauth_consumer_key=\"KKKKKKKKKKKKKK\", oauth_token=
> \"");
> header.appendStr(token);
> header.append("\", oauth_signature=\"");
> header.appendStr(sig);
> header.append("\", oauth_version=\"1.0\"");
>
> req.AddHeader("Authorization",header.getAnsi());
>
> BOOL success=FALSE;
>
> const char * domain;
> long port;
> bool ssl;
> domain = "api.twitter.com";
> port = 80;
> ssl = false;
>
>
> CkHttpResponse *resp = 0;
> resp = http.SynchronousRequest(domain,port,ssl,req);
>
>
>
>
> Please let me know what other info might help,
> MTCoder
>

MTCoder

unread,
Sep 10, 2010, 5:50:58 PM9/10/10
to Twitter Development Talk

MTCoder

unread,
Sep 14, 2010, 12:53:48 PM9/14/10
to Twitter Development Talk
thanks, that did the trick for reading the timeline. Now I'm having
problems writing to the account.
Any ideas?

basestring:
POST&http%3A%2F%2Fapi.twitter.com%2F1%2Fstatuses%2Fupdate.xml&
oauth_consumer_key%3DXXXXXXXXXXXXXXXXXXXXXXXXx%26
oauth_nonce%3D444E51674F345149343D3D6A4D54304D%26
oauth_signature_method%3DHMAC-SHA1%26
oauth_timestamp%3D1284482849%26
oauth_token%3DYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY%26
oauth_version%3D1.0%26
status%3Dsetting%2520up%2520my%2520twitter


Post:
POST /1/statuses/update.xml? HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Authorization: OAuth oauth_nonce="444E51674F345149343D3D6A4D54304D",
oauth_signature_method="HMAC-SHA1", oauth_timestamp="1284482849",
oauth_consumer_key="XXXXXXXXXXXXXXXXXXX",
oauth_token="YYYYYYYYYYYYYYYYYYYYYYYYYYYYYy",
oauth_signature="ImTblfpYy7xD%2FZBk7%2BqPqwgILqU%3D",
oauth_version="1.0"
Content-Length: 28

status=setting+up+my+twitter






On Sep 10, 3:57 pm, Tom van der Woerdt <i...@tvdw.eu> wrote:
> You should encode the values in the Authorization: header.
>
> Tom
>
> On 9/10/10 11:50 PM, MTCoder wrote:
>
>
>
>
>
>
>
> > i have written code (working code for a client app) up to the point of
> > posting/reading to a twitter timeline.
> > The user has allowed my app access and i have the token and token
> > secret.
> > Also i have double checked the signature and everything else and they
> > all seem correct (http://hueniverse.com/2008/10/beginners-guide-to-oauth-part-iv-signin...

Tom van der Woerdt

unread,
Sep 14, 2010, 1:36:19 PM9/14/10
to twitter-deve...@googlegroups.com
Is that your full request? I don't see a Host: header, I don't see an
User-Agent header, etc.

Tom

Reply all
Reply to author
Forward
0 new messages