Why are conflicting variables?

I get conflicting results between the javascript SDK framework and python manipulator variables. The Javascript SDK says that my user is not logged in, which is correct, while my template variable, which comes from the base request handler, says that my user is logged in and displays the username. Is there enough information to say what is wrong, or should I insert code that, in my opinion, matters here? Link to the login page with an error here . The example I used is called the runwithfriends demo application from facebook, and everything works with this application, except for using the application logic directly from the website, without requiring the user to be in the iframe of the application.

Also, I cannot get the real-time API to work. I can only save userID and not update user data - why? I have the code, but I'm not sure what is most relevant, but here are some of the request handlers, the corresponding code is basically exactly the same as the one in the demo application:

def render(self, name, **data): logging.debug('render') """Render a template""" if not data: logging.debug('no data') data = {} data[u'js_conf'] = json.dumps({ u'appId': facebookconf.FACEBOOK_APP_ID, u'canvasName': facebookconf.FACEBOOK_CANVAS_NAME, u'userIdOnServer': self.user.id if self.user else None, }) data[u'logged_in_user'] = self.user #variable that is the problem data[u'message'] = self.get_message() data[u'csrf_token'] = self.csrf_token data[u'canvas_name'] = facebookconf.FACEBOOK_CANVAS_NAME self.response.out.write(template.render( os.path.join( os.path.dirname(__file__), 'templates', name + '.html'), data)) 

And even stranger, I can also get the application in a state in which the javascript SDK says that the user is logged in, and the logged_in_user template logged_in_user says otherwise. Why are variables conflicting? Update: here are the screenshots from the weird input stream. I can go to my page and my facebook name will appear: enter image description here Then, when I go to the next page, it also looks good and has my name enter image description here But if I log out, then I will end up in an impossible state: my name + is logged out

enter image description here How to resolve this strange conflict between js and back-end?

Update. Since I only have this problem for one of my applications, I can take what works from my other application and integrate it. This page seems to work from my other application: http://cyberfaze.appspot.com/file/20985

+4
source share
1 answer

Your "user" probably refers to a Django user, not a Facebook user. Make sure you synchronize these two accounts correctly using your own authentication server. It is possible that the accounts go out of sync, that is, if the user switches browsers.

Keep in mind that the Facebook Python SDK will stop working after October 1st unless they upgrade to Oauth2.0, which is unlikely.

I just updated django-facebook-graph to work with the new authentication stream.

+2
source

All Articles