I'm trying to mimic the login page from the example http://tipfy-auth.appspot.com (source http://code.google.com/p/tipfy/source/browse/examples/auth/app/) without success. I seem to run in to problem when the user is redirected back to the page. The current request flow looks like:
LoginPage (LoginHandler
) -> Facebook redirect (FacebookAuthHandler
) 302 -> Facebook.com -> Facebook redirect (FacebookAuthHandler
) 302 -> SignupPage (SignupHandler
) 302 -> LoginPage(LoginHandler
).
The problem here (as far as I figured) is the last 302(http-redirect) from signup (should be endpoint) to the loginpage again.
After some intense logging (can't find away to test this locally) it seems that a session is set when returning from facebook. The session is stored as a dict on the request handler (FacebookAuthHandler
) in two places self.auth.session
(a dict) and self.session
(a SecureCookieSession
) but after the redirect to SignupPage the self.auth.session
is None.
The redirect from SignUpPage to LoginPage occurs due to that the SignupHandler
's get method has a decorator @login_required
that looks at self.auth.session
to determine if the reuquest should be handled here or be redirected.
So why aren't the self.auth.session preserved between requests while the self.session are? Are self.auth.session
set at every request? How are the sessions stored? If it's in the db, does the datastore type matter (master/slave or high replication).
I'm digging around the source code but can't find any thing helpful.
..fredrik
EDIT
Posted answer below.