Hi

I'm trying to change my status with perl, and without the Net::Twitter
module.

I'm using LWP useragent, and it works fine until the final call to
update the status, where I get a "incorrect signature".

Here's my signature base string:
my $signature_base_string = "oauth_consumer_key=
$hash{oauth_consumer_key}"."&oauth_nonce=
$nonce"."&oauth_signature_method=
$hash{oauth_signature_method}"."&oauth_timestamp=$epoch"."&oauth_token=
$token_final"."&oauth_version=1.0"."&status=test";

Then I escape the signature base string and concatenate it.
$signature_base_string =
URI::Escape::uri_escape_utf8($signature_base_string,'^\w.~-');
#$signature_base_string =
URI::Escape::uri_escape_utf8($signature_base_string,'^\w.~-');
$signature_base_string = 'POST'.'&'.$url_encode.'&'.
$signature_base_string;

I espace the token and consumer secret
$token_secret_final =
URI::Escape::uri_escape_utf8($token_secret_final,'^\w.~-');
$hash{oauth_consumer_secret} =
URI::Escape::uri_escape_utf8($hash{oauth_consumer_secret},'^\w.~-');
my $signature = $hash{oauth_consumer_secret}.'&'.$token_secret_final;

I encrypt the token and consumer secret, then add the base string
my $hmac = Digest::HMAC_SHA1->new($signature);
$hmac->add($signature_base_string);
my $signature = encode_base64($hmac->digest, '');
$signature = URI::Escape::uri_escape_utf8($signature,'^\w.~-');

I define the content type for header
$ua->default_header('Content-Type' => "application/x-www-form-
urlencoded");

And I post:
my $response = $ua->post($url,[
        'oauth_consumer_key'=>'blalba',
        'oauth_signature'=>"$signature",
        'oauth_signature_method'=>'HMAC-SHA1',
        'oauth_nonce'=>"$nonce",
        'oauth_timestamp'=>"$epoch",
        'oauth_token'=>"$token_final",
        'oauth_version'=>"1.0",
        'status'=>'test',
]);

And here it bugs, I don"t get it. It went fine for the request token
and access token...

If anyone could help me, I'm on it since 3 days now...

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

Reply via email to