Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister

Re^2: Understanding oAuth with Perl

by Gangabass (Vicar)
on Mar 09, 2011 at 18:05 UTC ( #892255=note: print w/ replies, xml ) Need Help??

in reply to Re: Understanding oAuth with Perl
in thread Understanding oAuth with Perl

Thank you for the reply. Now i have no problems with GET request but can't complete POSTs.

if ($app->authorized) { my $response = $app->view_restricted_resource('https://www.yammer. +com/api/v1/users.xml' ); print $response->content."\n"; $response = $app->update_restricted_resource("https://www.yammer.c +om/api/v1/messages/", body => "Message body", broadcast => "true" ); print $response->content."\n"; exit; }
I'll get error "POST on Net::OAuth::ProtectedResourceRequest=HASH(0x5590e74) failed: 302 Found". Can you explain why?

Comment on Re^2: Understanding oAuth with Perl
Download Code
Replies are listed 'Best First'.
Re^3: Understanding oAuth with Perl
by Anonymous Monk on Mar 10, 2011 at 12:56 UTC
      After checking
      When posting a new message, the response body will include the new message formatted as in message polling above. This allows you to immediately display the newly-posted message back to the user.
      I think its a bug that the api_doc doesn't explicitly list what type of status code the response should have, like it does for many other methods.

      I think you definitely need to check the content, maybe as per LWP::Debug?

      $app->{browser}->add_handler("response_done", sub { shift->dump; retur +n });

      Or maybe with

      ->SUPER::new( tokens => \%tokens, browser => WWW::Mechanize->new( autocheck => 0 ), )
      and then you can
      my $response = eval { $app->view_restricted_resource ... }; unless( $response ){ warn "ERROR $@ "; $response = $app->res; # WWW::Mechanize cache it for you } print $response->content;
      or something like that
Re^3: Understanding oAuth with Perl
by Anonymous Monk on Jun 25, 2012 at 23:37 UTC
    I got 401 Unauthorized response when I do POST. I have no issue with GET. Did you figure out your issue?

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://892255]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (10)
As of 2015-10-13 13:53 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (307 votes), past polls