Keep getting 401'd using WWW::Pusher in Perl -


i'm using www::pusher in perl try send test message keep getting 401 no reason.

here's http::request response dumped out. can see it's supposed be, yet still 401'd "invalid signature" when it's not. www::pusher's source code way , it's correct:

my $signature = "post\n".$uri->path."\n".$uri->query; $auth_signature = hmac_sha256_hex($signature, $self->{secret});  $request = http::request->new(     'post',     $uri->as_string."&auth_signature=".$auth_signature,     ['content-type' => 'application/json'],     $payload ); 

response dump:

$var1 = bless( {     '_protocol' => 'http/1.1',     '_content' => 'invalid signature: should have sent hmacsha256hex("post\\n/apps/77409/channels/eventname/events\\nauth_key=a07f61975e3c3f7903f3&auth_timestamp=1402292321&auth_version=1.0&body_md5=224adf45124f9ba44f83f49cc7964687&name=client rsync&socket_id=", your_secret_key), sent "bb8628f91445ac1251e90fb1ef8f0b568cf381b5f0a77dddf3faa890f22cfb68"',     '_rc' => '401',     '_headers' => bless( {             'connection' => 'close',             'client-response-num' => 1,             'client-peer' => 'x.x.x.x:80',             'content-length' => '339',             'client-date' => 'mon, 09 jun 2014 05:38:41 gmt',             'client-warning' => 'missing authenticate header',             'content-type' => 'text/html;charset=utf-8',             'server' => 'thin 1.6.1 codename death proof'         }, 'http::headers' ),     '_msg' => 'unauthorized',     '_request' => bless( {             '_content' => '"test message"',             '_uri' => bless( do{\(my $o = 'http://api.pusherapp.com:80/apps/77409/channels/eventname/events?auth_key=a07f61975e3c3f7903f3&auth_timestamp=1402292321&auth_version=1.0&body_md5=224adf45124f9ba44f83f49cc7964687&name=client+rsync&socket_id=&auth_signature=bb8628f91445ac1251e90fb1ef8f0b568cf381b5f0a77dddf3faa890f22cfb68')}, 'uri::http' ),             '_headers' => bless( {                 'user-agent' => 'libwww-perl/5.833',                 'content-type' => 'application/json'             }, 'http::headers' ),         '_method' => 'post',         '_uri_canonical' => bless( do{\(my $o = 'http://api.pusherapp.com/apps/77409/channels/eventname/events?auth_key=a07f61975e3c3f7903f3&auth_timestamp=1402292321&auth_version=1.0&body_md5=224adf45124f9ba44f83f49cc7964687&name=client+rsync&socket_id=&auth_signature=bb8628f91445ac1251e90fb1ef8f0b568cf381b5f0a77dddf3faa890f22cfb68')}, 'uri::http' )     }, 'http::request' ) }, 'http::response' ); 

this may significant:

'client-warning' => 'missing authenticate header', 

are perhaps expecting auth info in header instead of query string post requests?

never mind; docs indicate 401 have information problem in content, , indeed does:

invalid signature: should have sent hmacsha256hex("post\\n/apps/77409/channels/eventname/events\\nauth_key=a07f61975e3c3f7903f3&auth_timestamp=1402292321&auth_version=1.0&body_md5=224adf45124f9ba44f83f49cc7964687&name=client rsync&socket_id=", your_secret_key), sent "bb8628f91445ac1251e90fb1ef8f0b568cf381b5f0a77dddf3faa890f22cfb68" 

looks me signing "client+rsync" should signing "client rsync".

this per documentation:

the query parameters sorted key, keys converted lowercase, joined in query string. note string must not url escaped (e.g. given keys auth_key: foo, name: else, auth_key=foo&name=something else)


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -