Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re^2: Understanding oAuth with Perl

by Gangabass (Priest)
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
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
Node Status?
node history
Node Type: note [id://892255]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (7)
As of 2014-12-25 06:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (159 votes), past polls