bigpresh / ical-to-google-calendar

A script to sync an iCal/vcal calendar feed to a Google Calendar
12 stars 8 forks source link

Error : 401 Authorization required at /Library/Perl/5.12/Net/Google/Calendar.pm line 629 #1

Open yvangodard opened 11 years ago

yvangodard commented 11 years ago

Hi, Your script is exactly what I search but I've got some errors. First, I modified your code as this, in order to enter manually login/pass as options : http://paste.reseauenscene.fr/kopobujuqu.perl

But, when I run the script, this error happens after parsing all events in ICS file : "401 Authorization required at /Library/Perl/5.12/Net/Google/Calendar.pm line 629."

Have you any idea to solve this ?

Thanks a lot for your help !

Yvan

bigpresh commented 11 years ago

Hmm. Line 629 of Net/Google/Calendar.pm appears to be in get_feed:

die $r->status_line unless $r->is_success;

So, the HTTP request it sends comes back unauthorised.

My initial guess is that, perhaps, you're seeing/selecting a calendar that is shared with you, but you don't have rights to modify - but I would still expect a get request to work. Hmm.

Probably a good way to get more info is to see the raw requests sent and received by LWP under the hood of Net::Google::Calendar. You could run under the debugger and examine things as the script progresses, but if you just want to dump the HTTP responses you could poke at the LWP user agent object within the Net::Google::Calender object, so if you add this after instantiating Net::Google::Calendar, you should get requests and responses dumped:

$gcal->{_ua}->add_handler("request_send",  sub { shift->dump; return });
$gcal->{_ua}->add_handler("response_done", sub { shift->dump; return });

(Dirty poking around at the internals of another module, but I consider that OK for temporary debugging purposes :) )

sgu222e commented 10 years ago

@yvangodard Did you solve this? I'm seeing the same thing.

yvangodard commented 10 years ago

So, I had this problem on Mac but the same thnig woks well on Debian 6. It seems to be a problem with CPAN Libraries ? You could have a look to my blog : http://www.yvangodard.me/synchroniser-plusieurs-fichiers-ics-ical-avec-des-calendriers-google-agenda/ http://www.yvangodard.me/synchroniser-un-fichier-ics-ical-avec-un-calendrier-google-agenda/

bigpresh commented 10 years ago

Is this still an issue for either of you? Does it happen with the most up to date Net::Google::Calendar?

q84fh commented 9 years ago

Hello, I have simillar problem: 403 Forbidden at /usr/share/perl5/site_perl/Net/Google/Calendar.pm line 629. Line 629 is

die $r->status_line unless $r->is_success;

just like above. When I browsing to URL http://www.google.com/calendar/feeds/default/allcalendars/full i getting 403 error immediately, without prompting for user and password pair, and regardless if I'am already authenticated to Google, or not.

q84fh@jakobina:~/ > ical2gcal.pl --calendar "test" --ical_url http://127.0.0.1/~q84fh/kalendarz.ics
GET http://www.google.com/calendar/feeds/default/allcalendars/full
User-Agent: libwww-perl/6.08

(no content)
HTTP/1.1 403 Forbidden
Cache-Control: private, max-age=0
Connection: close
Date: Mon, 12 Jan 2015 19:01:23 GMT
Accept-Ranges: none
Server: GSE
Vary: Accept-Encoding
Content-Type: text/html; charset=UTF-8
Expires: Mon, 12 Jan 2015 19:01:23 GMT
Alternate-Protocol: 80:quic,p=0.02
Client-Date: Mon, 12 Jan 2015 19:01:24 GMT
Client-Peer: 74.125.71.104:80
Client-Response-Num: 1
Title: Forbidden
X-Content-Type-Options: nosniff
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block

<HTML>
<HEAD>
<TITLE>Forbidden</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Forbidden</H1>
<H2>Error 403</H2>
</BODY>
</HTML>\n
403 Forbidden at /usr/share/perl5/site_perl/Net/Google/Calendar.pm line 629.

It's because APIv2 has been shut down on November 17, 2014. https://developers.google.com/google-apps/calendar/v2/reference#Calendar_feeds.

Do you have any ideas how to get thing working again?

Net::Google::Calendar is using old API.