Logging shows successful connection but self.logged_in is false

80 views
Skip to first unread message

Bob Rupholdt

unread,
Oct 2, 2012, 2:24:42 PM10/2/12
to gae-sim...@googlegroups.com
I'm sure it's my code, I'm new to Python.  I had it working, or so I thought but if I login then out repeatedly, it eventually stops working.  I thought it was just my laptop.  I reinstalled Chrome and it worked again.  But after a little while, it stopped working.  Because I'm in development, I'm obviously testing the site a lot.  No one else is using it but everyone else I have test it has no problem.  I finally duplicated the error on another machine (also using Chrome) by logging in and out repeatedly.

When authenticated, the profile page should show.  When not authenticated, accessing the profiles page redirects to the home page.  When the problem occurs, it logs in but then redirects to the home page.  Logging shows the attempt was successful as far as I can tell.

The page can be seen at http://www.nobiblenobreakfast.com/ The code being used is almost exactly the simpleauth demo.  I don't think I've made any changes to it at all besides editing the secrets.  Only Google auth is enabled thus far.

It might be related to using different user accounts alternately.  I have more than one authenticated Google account.  I can switch between them just fine when it's working.  Once it stops working, it doesn't matter which login I try, it will not work.  Logging out of all accounts, rebooting, logging in with only one account - none of them work once whatever goes wrong goes wrong.


alex

unread,
Oct 2, 2012, 3:19:51 PM10/2/12
to gae-sim...@googlegroups.com
I've just tried what you described - logging in and out a few times on
the website and got the same result: it no longer logs me in. I'm
signed in with only one account on Google so this is definitely not
related to having multiple accounts.

I couldn't reproduce it on simpleauth.appspot.com though (this is
exact same example app from GitHub repo).

I feels very much something like cookie-related. If you open a new
Chrome *Incognito* window (i.e. blank slate, no cookies, etc.) it'll
sign you in and show profile page successfully.

Most likely, it is something related to how you set session. Maybe you
had some other part in your app where you handle/set session and
coping the example app code duplicates it? I'm talking about example's
BaseRequestHandler.dispatch method:
https://github.com/crhym3/simpleauth/blob/master/example/handlers.py#L22

Can you verify that you don't have something like
"session_store.save_sessions(..)" in multiple places?
> --
> You received this message because you are subscribed to the Google Groups
> "SimpleAuth for GAE" group.
> Visit this group at http://groups.google.com/group/gae-simpleauth?hl=en.
>
>

Bob Rupholdt

unread,
Oct 2, 2012, 4:22:35 PM10/2/12
to gae-sim...@googlegroups.com
That was it.  I had baserequesthandler in two places.  I thought it acted like it was sometime getting a different "self" but I didn't even know if that was possible.  When I split my code out to make it more manageable, I left a copy of baserequesthandler in the original file as well.  When I removed the copy then fixed the includes, it began working again.

Thank you!  I knew it had something to do with being a nube.

BTW, you're examples are excellent.  Knowing next to nothing I was able to implement it based on following the example code.  I wish everyone were so thorough in their work.


alex

unread,
Oct 2, 2012, 7:11:34 PM10/2/12
to gae-sim...@googlegroups.com
Thanks! I'm glad it worked out.
Reply all
Reply to author
Forward
0 new messages