Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

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?

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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2018-05-25 15:22 GMT
Find Nodes?
    Voting Booth?