Hi
I'd like to see per-framework solutions for certain usecases rather than per-application, that's why I message everybody I know who is a GAE developer to know how they do OAuth 2.0 and what's the official way to do it.
My efforts to add OAuth 2.0 works OK with plain GAE and the reason I message everybody about this is to save time: How to add a function render to a base requesthandler class? If we have a render function we can populate it with serverside variables.
I think that the requesthandler can't be a singleton since the user object will depend on who is logged in. So what I could need for adding the OAuth 2.0 functionality is an agreement where to put for instance this code:
@property def current_user(self): if not hasattr(self, "_current_user"): self._current_user = None cookie = facebook.get_user_from_cookie( self.request.cookies, facebookconf.FACEBOOK_APP_ID, facebookconf.FACEBOOK_APP_SECRET) logging.debug("logging cookie"+str(cookie)) if cookie: # Store a local instance of the user data so we don't need # a round-trip to Facebook on every request user = FBUser.get_by_key_name(cookie["uid"]) logging.debug("user "+str(user)) if not user: graph = facebook.GraphAPI(cookie["access_token"]) profile = graph.get_object("me") user = FBUser(key_name=str(profile["id"]), id=str(profile["id"]), name=profile["name"], profile_url=profile["link"], access_token=cookie["access_token"]) user.put() elif user.access_token != cookie["access_token"]: user.access_token = cookie["access_token"] user.put() self._current_user = user return self._current_userPlease let us know what you think of the above code. I asked many questions about it on SO and they say use a hacked facebook python SDK from githus which I don't think is ideal. From where do you recommend that we take the facebook code? If you want you may inspect my project
montao.googlecode.com which has some but not perfect OAuth 2.0 integration where I do it serverside for the
website and also with the javascript SDK for the
FB app.
Thank you
Niklas R