Problem with facebook auth with tipfy 1.0b

I am trying to simulate 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 have run into a problem when the user is redirected back to the page. The current request stream looks like this:

LoginPage ( LoginHandler) → Facebook redirect ( FacebookAuthHandler) 302 → Facebook.com → Facebook redirect ( FacebookAuthHandler) 302 → RegistrationPage ( SignupHandler) 302 → LoginPage ( LoginHandler).

The problem here (as I understand it) is the last 302 (http-redirect) from registration (should be the endpoint) on the login page again.

After some intensive logging (I can’t find it for local testing), it seems that the session is established when you return from facebook. The session is stored as a dict in the request handler ( FacebookAuthHandler) in two places self.auth.session(a dict) and self.session(a SecureCookieSession), but after redirecting to RegistrationPage self.auth.sessionthere is None.

The redirect from SignUpPage to LoginPage is due to the fact that the SignupHandlerget method has a decorator @login_requiredthat looks at self.auth.sessionto determine whether the reuquest should be processed here or redirected.

, self.auth.session , self.session? self.auth.session ? ? db, (master/slave ).

, .

..

.

+5
1

, SessionAuthStore.

( @login_required , ) ( tipfy.auth.SessionAuthStore):

if not self.loaded:
    self._load_session_and_user()

return self._session

, _load_session_and_user "" .

, Facebook. , .

, , @login_required (tipfy.auth.init.py)

if not auth.session:
        auth._load_session() # If no session try to load it from the _session_base

    if not auth.session:
        return handler.redirect(auth.login_url())

MultiAuthStore.

def _load_session(self):
        self.loaded = True
        session = self._session_base.get('_auth', {})
        if session:
            self._session = session

, , .

+1

All Articles