Hello Julian,
thank you for your answer,
i sent this request, but i get error "Unknown authorization header". is
there enough to send cosumer_key and consumer_secret,
what is with token and token_secret?
my $req = Net::OAuth->request('consumer')->new(
consumer_key => 'xxx',
consumer_secret => 'xxx',
request_url => '
http://www.google.com/m8/feeds/contacts/default/full',
signature_method => 'HMAC-SHA1',
request_method => 'GET',
timestamp => time,
nonce => join('', rand_chars(size=>16, set=>'alphanumeric')),
extra_params => {
xoauth_requestor_id => $user_email,
'max-results' => 1,
},
);
mike
2009/4/6 Julian (Google) <[email protected]>
>
> Hi,
>
> I think you should add extra_params with the xoauth and the max-
> results information, for example:
>
> my $request = Net::OAuth->request('consumer')->new(
> consumer_key => $consumer_key,
> consumer_secret => $consumer_secret,
> request_url => $url,
> signature_method => 'HMAC-SHA1',
> request_method => 'GET',
> timestamp => $time,
> nonce => $nonce,
> extra_params => {
> xoauth_requestor_id => $user_email,
> 'max-results' => 1,
> },
> );
>
> -Julian
>
> On Apr 5, 12:00 pm, mike <[email protected]> wrote:
> > Hello,
> >
> > i make a request like this:
> >
> > #!/usr/bin/perl -w
> >
> > use strict;
> > use Net::OAuth;
> > use HTTP::Request::Common;
> > use LWP::UserAgent;
> > use Data::Dumper;
> > my $ua = LWP::UserAgent->new;
> > #use Test::More tests => 12;
> > use Data::Random qw(rand_chars);
> >
> > my $req = Net::OAuth->request("protected resource")->new(
> > consumer_key => 'xxx',
> > consumer_secret => 'xxx',
> > request_method => 'GET',
> > signature_method => 'HMAC-SHA1',
> > timestamp => time,
> > nonce => join('', rand_chars(size=>16,
> > set=>'alphanumeric')),
> > request_url => 'http://www.google.com/m8/feeds/contacts/
> > default/full',
> > token => 'xxx',
> > token_secret => 'xxx',
> > );
> >
> > $req -> sign();
> > my $res = $ua->request(GET($req->request_url,
> > Authorization => $req->to_authorization_header));
> >
> > if (!$res->is_success) {
> > die 'Could not get feed: ' . $res->status_line . ' ' . $res->content;
> > }else{
> >
> > print $res->status_line;
> >
> > }
> >
> > but when i try a url with a param like this
> >
> > request_url => 'http://www.google.com/m8/feeds/contacts/default/full?
> > max-result=5'
> >
> > i get this error "Unknown authorization header"
> >
> > any ideas?
> >
> > best requards
> >
>
--
mfg Holm
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Contacts API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/google-contacts-api?hl=en
-~----------~----~----~----~------~----~------~--~---