Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: CGI::Application::Plugin::Authentication not working on Google Chrome

by scorpio17 (Canon)
on Mar 12, 2013 at 15:24 UTC ( #1022997=note: print w/replies, xml ) Need Help??

in reply to CGI::Application::Plugin::Authentication not working on Google Chrome

I have a bunch of web apps that use CGI::Application::Plugin::Authentication and they all function correctly with the latest versions of IE, FireFox, and Chrome on Win7, WinXP, and Ubuntu (10.04LTS and 12.04LTS).

SO... I hate to say it, but there's probably a bug in your code, not in the module. You shouldn't need to, for example, specifically call CGI::Session->new() in your run mode... I know you're only trying to reproduce the problem, but that looks weird. Assuming that you're also using CGI::Application::Plugin::Session, you only need to use $self->session(). And, assuming that your sessions are stored in a database back end, you should also be using CGI::Application::Plugin::DBH. Configuring these three to play nice with each other can be a little tricky.

Here's a link to a simple login tutorial I wrote a long time ago:
RFC: Proposed tutorial - simple login script using CGI::Application

Compare your code to my demo, especially the part that initializes the session module and the authorization module and see if you can spot any differences. That should help get you started.

Good luck!

  • Comment on Re: CGI::Application::Plugin::Authentication not working on Google Chrome

Replies are listed 'Best First'.
Re^2: CGI::Application::Plugin::Authentication not working on Google Chrome
by bcrowell2 (Friar) on Mar 12, 2013 at 15:36 UTC
    Aha -- the combination of your reply and Anonymous Monk's did the trick. I examined the headers directly and got this:
    $ ./ Set-Cookie: login=Yz1jamd1SEMxYm43MHJsNDQramdTUDZFREJPUlU%3D; path=/; +expires=1d Date: Tue, 12 Mar 2013 15:24:49 GMT Content-Type: text/html; charset=ISO-8859-1
    The "expires" string should be an actual date string, not the offset "1d." The problem was that the offset needed to be "+1d," as shown in your example. I then get this:
    $ ./ Set-Cookie: login=Yz1jamd1SEMxYm43MHJsNDQramdTUDZFREJPUlU%3D; path=/; +expires=Wed, 13-Mar-2013 15:34:59 GMT Date: Tue, 12 Mar 2013 15:34:59 GMT Content-Type: text/html; charset=ISO-8859-1
    Apparently most browsers accept a malformed "expires" value and make the cookie a session cookie as a result, but chrome doesn't accept such a cookie at all.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1022997]
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: (1)
As of 2022-11-26 11:44 GMT
Find Nodes?
    Voting Booth?