Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^2: Understanding oAuth with Perl

by Gangabass (Vicar)
on Mar 09, 2011 at 18:05 UTC ( [id://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
      https://www.yammer.com/api_doc.html#resources_messages_manipulating
      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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2024-04-20 03:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found