Not likely. From your error message it looks like you are either not sending an array of parameters to Net::OAuth or it is dropping them somewhere. I don't know Perl though so I can't really help any further.
On Wed, Apr 22, 2009 at 18:39, Jesse Stay <[email protected]> wrote: > Is my issue because OAuth is disabled? Just want to be sure before I look > into it more (as soon as OAuth is back). > Thanks, > > Jesse > > > On Wed, Apr 22, 2009 at 1:40 AM, Jesse Stay <[email protected]> wrote: > >> Matt, here's what I'm getting back: >> On Tue, Apr 21, 2009 at 9:58 AM, Matt Sanford <[email protected]> wrote: >> >>> >>> Hi Jesse, >>> >>> The best debugging information is: >>> >>> 1. The error message from your 401. >>> » Example: "Failed to validate oauth signature or token" >> >> >> "Missing authenticate header" >> >> >>> >>> >>> 2. The signature base string. In other words, the string you used to >>> create the signature. >>> » Example: See [1] for an example. >>> >> >> Any idea how to get this using Perl's Net::OAuth? >> >> >>> >>> 3. What oauth application is this for? >>> » Example: http://twitter.com/oauth_clients/details/104 >> >> >> It's for the SocialToo.com application: >> http://twitter.com/oauth_clients/details/61 >> >> >> >>> >>> On Apr 20, 2009, at 07:59 PM, Jesse Stay wrote: >>> >>> I'm getting 401 Unauthorized when trying to use Net::OAuth in Perl to >>>> access Twitter - it's happening in trying to swap the request token for the >>>> access token (in the second block below, from the $ua->post()). I was just >>>> wondering what the best method for debugging this would be. Here's my code >>>> (it's in Catalyst, so the $c's are from the Framework environment): >>>> >>>> sub authenticate_twitter : Local { >>>> my ($self, $c) = @_; >>>> >>>> unless ($c->user_session->{'request_token'} && >>>> $c->user_session->{'request_token_secret'}) { >>>> my $request = Net::OAuth->request("request token")->new( >>>> consumer_key => $c->config->{'twitter_consumer_key'}, >>>> consumer_secret => $c->config->{'twitter_consumer_secret'}, >>>> request_url => $c->config->{'twitter_request_url'}, >>>> request_method => 'GET', >>>> signature_method => 'HMAC-SHA1', >>>> timestamp => time, >>>> nonce => join('', rand_chars(size=>16, set=>'alphanumeric')), >>>> ); >>>> $request->sign(); >>>> >>>> $c->log->debug("URL: ".$request->to_url); >>>> >>>> my $ua = LWP::UserAgent->new; >>>> my $res = $ua->get($request->to_url); # post request to Twitter >>>> >>>> if ($res->is_success) { >>>> my $response = Net::OAuth->response('request >>>> token')->from_post_body($res->content); >>>> $c->user_session->{'request_token'} = $response->token; >>>> $c->user_session->{'request_token_secret'} = >>>> $response->token_secret; >>>> >>>> if (defined $c->user_session->{'request_token'}) { >>>> my $auth_url = >>>> $c->config->{'twitter_authorize_token_url'}."?oauth_token=" . >>>> $c->user_session->{'request_token'} . >>>> "&redirect_url=".uri_escape($c->req->param("redi >>>> rect_url"));; >>>> $c->res->redirect($auth_url); >>>> $c->detach; >>>> return; >>>> } >>>> } >>>> else { >>>> $c->log->fatal("Something went wrong."); >>>> } >>>> } >>>> else { >>>> $c->log->debug("request_token: >>>> ".$c->user_session->{'request_token'}); >>>> $c->log->debug("request_token_secret: >>>> ".$c->user_session->{'request_token_secret'}); >>>> my $request = Net::OAuth->request("access token")->new( >>>> consumer_key => $c->config->{'twitter_consumer_key'}, >>>> consumer_secret => >>>> $c->config->{'twitter_consumer_secret'}, >>>> token => $c->user_session->{'request_token'}, >>>> token_secret => >>>> $c->user_session->{'request_token_secret'}, >>>> request_url => >>>> $c->config->{'twitter_access_token_url'}, >>>> request_method => 'POST', >>>> signature_method => 'HMAC-SHA1', >>>> timestamp => time, >>>> nonce => join('', rand_chars(size=>16, >>>> set=>'alphanumeric')), >>>> ); >>>> $request->sign(); >>>> >>>> $c->log->debug("URL: ".$request->to_url); >>>> >>>> my $ua = LWP::UserAgent->new; >>>> my $res = $ua->post($request->to_url); # post request to Twitter >>>> >>>> if ($res->is_success) { >>>> my $response = Net::OAuth->response('access >>>> token')->from_post_body($res->content); >>>> $c->user_session->{'access_token'} = $response->token; >>>> $c->user_session->{'access_token_secret'} = >>>> $response->token_secret; >>>> >>>> >>>> $c->res->redirect(uri_unescape($c->req->param('redirect_url'))); >>>> } >>>> else { >>>> $c->log->fatal("Could not get an Access Token: " . >>>> $res->status_line . " " . $res->content); >>>> } >>>> >>>> } >>>> >>>> } >>>> >>>> -...@jesse >>>> >>> >>> >> > -- Abraham Williams | http://the.hackerconundrum.com Hacker | http://abrah.am | http://twitter.com/abraham Web608 | Community Evangelist | http://web608.org This email is: [ ] blogable [x] ask first [ ] private.
