{ "info": { "author": "Tino de Bruijn", "author_email": "tinodb@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "Facebook integration for your Django website\n=============================================\n\nTODO: Document the server-side login flow, and the difference between both.\n\nRequirements\n------------\n\nSome recent version of jQuery. TODO: Document where it's needed and give example\n\nFacebook Login\n--------------\n\nWith Facebook there are two ways to log in\n(http://developers.facebook.com/docs/authentication/):\n\n- through the server-side flow\n- through the client-side flow\n\ndjango_facebook provides methods for both these flows. For completeness and\nthings like reducing the number of requests you need to make to FB\nserver-sided, you want to be authenticated on both sides. Unfortunately\nfacebook per 31 december 2011 deprecated\n(http://developers.facebook.com/blog/post/624/) their cookie that gave us an\neasy way to get the authentication details on the server when somebody was\nlogged in on the client side. To overcome this, an ajax post request is made,\nas soon as somebody logs in on the client side, to notify the server and give\nit a change to log someone in.\n\nInstallation\n------------\n\nSimply add ``django_facebook`` to your INSTALLED_APPS and configure\nthe following settings:\n\n FACEBOOK_APP_ID = ''\n FACEBOOK_APP_SECRET = ''\n FACEBOOK_REDIRECT_URI = ''\n\n # Optionally set default permissions to request, e.g: ['email', 'user_friends']\n FACEBOOK_PERMS = []\n\n # And for local debugging, use one of the debug middlewares and set:\n FACEBOOK_DEBUG_TOKEN = ''\n FACEBOOK_DEBUG_UID = ''\n FACEBOOK_DEBUG_COOKIE = ''\n FACEBOOK_DEBUG_SIGNEDREQ = ''\n\n\nTemplates\n---------\n\nA few helpers for using the Javascript SDK can be enabled by adding\nthis to your base template before other javascript that makes use of facebook:\n\n {% load facebook %}\n {% facebook_init %}\n {% block facebook_code %}{% endblock %}\n {% endfacebook %}\n\nAnd this should be added just before your ```` tag:\n\n {% facebook_load %}\n\nThe ``facebook_load`` template tag inserts the code required to\nasynchronously load the facebook javascript SDK. The ``facebook_init``\ntag calls ``FB.init`` with your configured application settings. It is\nbest to put your facebook related javascript into the ``facebook_code``\nregion so that it can be called by the asynchronous handler.\n\nYou may find the ``facebook_perms`` tag useful, which takes the setting\nin FACEBOOK_PERMS and prints the extended permissions out in a\ncomma-separated list.\n\n \n\n\nOnce this is in place you are ready to start with the facebook javascript SDK!\n\nThis module also provides all of the tools necessary for working with facebook\non the backend:\n\n\nMiddleware\n----------\n\nThere are a couple of different middleware classes that can be enabled to do\nvarious things.\n\nThere is ``FacebookLoginMiddleware`` to log a user in if a facebook cookie is\npresent. As a counter part, there is ``FacebookLogoutMiddleware`` that logs a\nuser out when that cookie is not present anymore. For these two middlewares to\nwork, you need to add ``'django_facebook.auth.FacebookModelBackend'`` to your\n``AUTHENTICATION_BACKENDS`` setting.\n\nAs a helper, there is ``FacebookHelperMiddleware``, that sets a ``facebook``\nobject on the request, containing:\n\n- ``user_id``: If the user is logged in, this will be the facebook user id\n- ``access_token``: A lazy access_token\n- ``auth``: An instantiation of ``facebook.Auth``, an object to do\n authentication stuff with, like getting a new access_token\n- ``graph``: An instantiation of ``facebook.GraphAPI``.\n\nThe ``FacebookMiddleware`` activates above three middlewares as a shortcut and\nfor backwards compatibility. With it installed you can do:\n\n def friends(request): if request.facebook.user_id: friends =\nrequest.facebook.graph.get_connections('me', 'friends')\n\nTo use the middleware, simply add this to your MIDDLEWARE_CLASSES:\n\n 'django_facebook.middleware.FacebookMiddleware'\n\n### Debugging:\n\nFor debugging the following middleware classes are available:\n\n``FacebookDebugCookieMiddleware`` allows you to set a cookie in your settings\nfile and use this to simulate facebook logins offline.\n\n``FacebookDebugTokenMiddleware`` allows you to set a user_id and access_token to\nforce facebook graph availability.\n\n``FacebookDebugCanvasMiddleware`` allows you to set a signed_request to mimic\na page being loaded as a canvas inside Facebook.\n\n\nAuthentication\n--------------\n\nThis provides seamless integration with the Django user system.\n\ndjang_facebook defines one backend that \"authenticates\" users. The real\nauthentication is done through the facebook API of course, so this backend\nonly ensures a user exists within our database. If a user doesn't exist, it\nwil be created, and the [django_facebook.auth.facebook_user_created](#signals)\nsignal will be fired. Connect to this signal to populate profile data for\nexample.\n\nDon't forget to include the default backend if you want to use standard\nlogins for users as well:\n\n 'django.contrib.auth.backends.ModelBackend'\n\n\nDecorators and Mixins\n---------------------\n\n``@facebook_required`` is a decorator which ensures the user is currently\nlogged in with facebook and has access to the facebook graph. It is a replacement\nfor ``@login_required`` if you are not using the facebook authentication backend.\n\n``@canvas_only`` is a decorater to ensure the view is being loaded with\na valid ``signed_request`` via Facebook Canvas. If signed_request is not found, the\ndecorator will return a HTTP 400. If signed_request is found but the user has not\nauthorised, the decorator will redirect the user to authorise.\n\nThe ``utils.FacebookRequiredMixin`` is a class-based-view mixin that can be\nused when using CBV's. It needs to come before any other metaclasses otherwise\nit will not work. For example:\n\n class MyView(FacebookRequiredMixin, django.views.generic.DetailView):\n # rest of view...\n\n\nSignals\n-------\n\ndjango_facebook defines a signal:\n``django_facebook.auth.facebook_user_created``. It is fired when the\nFacebookModelBackend creates a user, and is passed ``user``, being the just\ncreated user, and ``facebook`` the facebook helper object that you can use to\ninteract with facebook (the ``FacebookHelperMiddleware`` needs to be\ninstalled for this, otherwise the ``facebook`` kwarg will be ``None``).\n\nAsynchronous\n------------\n\nIt is advisable to handle connections with external api's asynchronous with\nthe request, so your user don't need to wait if facebook takes a little more\ntime then usual. This app is built with that idea in mind, and there only\nmakes calls to facebook when necessary. This means that when a facebook cookie\nis present, by default no call to facebook is made to validate that cookie and\nto obtain an access-token.\n\nThe ``access_token`` set on the facebook helper object is a 'lazy' access_token.\nThis means that the access_token is only obtained or validated at the last\nmoment. When the access_token is expired, a new one will be obtained if\npossible.\n\nThe access_token is stored in the users session, so django's SessionMiddleware\nneeds to be installed.\n\nOriginal Author\n---------------\n\nThis app was originally forked from Aidan Lister's http://github.com/pythonforfacebook/django-facebook and changed heavily. I therefore decided to release it as a new app (under the same license).", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/tino/django-facebook2", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-facebook2", "package_url": "https://pypi.org/project/django-facebook2/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-facebook2/", "project_urls": { "Download": "UNKNOWN", "Homepage": "http://github.com/tino/django-facebook2" }, "release_url": "https://pypi.org/project/django-facebook2/0.3.2/", "requires_dist": null, "requires_python": null, "summary": "Facebook Authentication for Django", "version": "0.3.2" }, "last_serial": 1662072, "releases": { "0.2": [ { "comment_text": "", "digests": { "md5": "aa8d4a9270d0bbd9f639be8d2bf7a32e", "sha256": "0ef33eb2a40e2ea6e8909a8ee67ffcc0d42a73f868dd62dca36d42168c25dfe6" }, "downloads": -1, "filename": "django_facebook2-0.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "aa8d4a9270d0bbd9f639be8d2bf7a32e", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 23164, "upload_time": "2015-02-09T20:09:02", "url": "https://files.pythonhosted.org/packages/07/eb/f069c5d73a2e5798798b929ec15530a2e9e8df316058ca8dde3a329c9736/django_facebook2-0.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d72e3d1da17ada94c7494f350f938e57", "sha256": "ab5987af9d2c3b5fe483c0b654157df23a07a393380a3a0036eed16e4065b27d" }, "downloads": -1, "filename": "django-facebook2-0.2.tar.gz", "has_sig": false, "md5_digest": "d72e3d1da17ada94c7494f350f938e57", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13933, "upload_time": "2015-02-09T20:09:00", "url": "https://files.pythonhosted.org/packages/26/dd/b5d406c8ce7c8b03adaf984e4a824251ad4bb4adf6a1761c6891ce99f76c/django-facebook2-0.2.tar.gz" } ], "0.3": [ { "comment_text": "", "digests": { "md5": "a052e8496530998c83119886be0da2da", "sha256": "4719589519136c601acfdd67936c3c0beea25f0682d050ca87023172985e40e9" }, "downloads": -1, "filename": "django_facebook2-0.3-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "a052e8496530998c83119886be0da2da", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 23989, "upload_time": "2015-02-09T22:48:04", "url": "https://files.pythonhosted.org/packages/f8/03/1aa67d5452c9d8f815ef989f42aabefc509df0462d267f66c603aa97b610/django_facebook2-0.3-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "d3b51180fd4eab58a18514496fc5ea9e", "sha256": "8af599733a14befdb0a281e8154da144be249991b122ef9590c86eb2ec0a8780" }, "downloads": -1, "filename": "django-facebook2-0.3.tar.gz", "has_sig": false, "md5_digest": "d3b51180fd4eab58a18514496fc5ea9e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15153, "upload_time": "2015-02-09T22:48:01", "url": "https://files.pythonhosted.org/packages/f7/f0/50182822d8e0e9f58dc3abe9f103aa8877f64594a3a6a81a435566856665/django-facebook2-0.3.tar.gz" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "d1e2a2cc39a751bdad67cb06f10e27f5", "sha256": "43e54858358b81935ec0a33f332ed95f4bd0e0d58479e6c5eff2c467a9f406e8" }, "downloads": -1, "filename": "django_facebook2-0.3.1-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "d1e2a2cc39a751bdad67cb06f10e27f5", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 24029, "upload_time": "2015-02-09T22:54:51", "url": "https://files.pythonhosted.org/packages/2f/c9/f15ffc765ca8ae8fc26dfe2da446a88d98cb86b925de1a7d7d35bf6a9b23/django_facebook2-0.3.1-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "8e97ac8e87dc5ce916352363291af839", "sha256": "4aa1987ecfff6bf6055146d5244f143da13e3f6fae8608808d05ce4e17b7437b" }, "downloads": -1, "filename": "django-facebook2-0.3.1.tar.gz", "has_sig": false, "md5_digest": "8e97ac8e87dc5ce916352363291af839", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15175, "upload_time": "2015-02-09T22:54:49", "url": "https://files.pythonhosted.org/packages/be/ce/cd844602279fd680b2c3ee8fdeb563a53ce6d37412c15c3d6b8808fa7987/django-facebook2-0.3.1.tar.gz" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "8bd6b84f0bada8cb5847d421e01971b1", "sha256": "7606d7f150c5b3577625dea66ef958773622a5af80f888d9bdf664374c87f2a6" }, "downloads": -1, "filename": "django_facebook2-0.3.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8bd6b84f0bada8cb5847d421e01971b1", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 24036, "upload_time": "2015-08-03T15:23:08", "url": "https://files.pythonhosted.org/packages/0f/f6/8919fdf0e79e95b3d1f7b860a32ff0431f9d06f5eb9ba82c042d8011306a/django_facebook2-0.3.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c85562bbaaf382570ea82c79dfb22168", "sha256": "df967c8d0c6dad030b242ba4d44241e760d8d11570678ee5d02d48485bd59575" }, "downloads": -1, "filename": "django-facebook2-0.3.2.tar.gz", "has_sig": false, "md5_digest": "c85562bbaaf382570ea82c79dfb22168", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15176, "upload_time": "2015-08-03T15:23:04", "url": "https://files.pythonhosted.org/packages/b0/b7/e2ba478817c37725a607e569d4743264d4d5f96619f79b60e3464bf6ef1a/django-facebook2-0.3.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "8bd6b84f0bada8cb5847d421e01971b1", "sha256": "7606d7f150c5b3577625dea66ef958773622a5af80f888d9bdf664374c87f2a6" }, "downloads": -1, "filename": "django_facebook2-0.3.2-py2.py3-none-any.whl", "has_sig": false, "md5_digest": "8bd6b84f0bada8cb5847d421e01971b1", "packagetype": "bdist_wheel", "python_version": "2.7", "requires_python": null, "size": 24036, "upload_time": "2015-08-03T15:23:08", "url": "https://files.pythonhosted.org/packages/0f/f6/8919fdf0e79e95b3d1f7b860a32ff0431f9d06f5eb9ba82c042d8011306a/django_facebook2-0.3.2-py2.py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "c85562bbaaf382570ea82c79dfb22168", "sha256": "df967c8d0c6dad030b242ba4d44241e760d8d11570678ee5d02d48485bd59575" }, "downloads": -1, "filename": "django-facebook2-0.3.2.tar.gz", "has_sig": false, "md5_digest": "c85562bbaaf382570ea82c79dfb22168", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15176, "upload_time": "2015-08-03T15:23:04", "url": "https://files.pythonhosted.org/packages/b0/b7/e2ba478817c37725a607e569d4743264d4d5f96619f79b60e3464bf6ef1a/django-facebook2-0.3.2.tar.gz" } ] }