How to make Facebook Login possible in Django app ?

怎甘沉沦 提交于 2020-01-28 13:06:59

问题


I have created a Django application. The app has a login functionality.

Can somebody help to find a way to make it possible to login using Facebook credential or point me some tutorials to implement it ?


回答1:


Summary;

  • https://github.com/mlavin/django-all-access
  • https://github.com/pennersr/django-allauth
  • https://github.com/omab/django-social-auth
  • https://github.com/uswaretech/Django-Socialauth
  • https://github.com/hiidef/oauth2app
  • https://github.com/timetric/django-oauth
  • https://github.com/daaku/django-oauth-consumer
  • https://github.com/eldarion/django-oauth-access
  • https://github.com/dgouldin/python-oauth2
  • https://github.com/henriklied/django-twitter-oauth
  • https://launchpad.net/django-openid-auth
  • https://www.djangopackages.com/grids/g/oauth/
  • http://peterhudec.github.io/authomatic/

django-all-access


django-all-access is a reusable application for user registration and authentication from OAuth 1.0 and OAuth 2.0 providers such as Twitter and Facebook.

The goal of this project is to make it easy to create your own workflows for authenticating with these remote APIs. django-all-access will provide the simple views with sane defaults along with hooks to override the default behavior.

There is a simple demo application running on at http://allaccess-mlavin.dotcloud.com/ The full source of this application is include in the repository.

django-allauth


Integrated set of Django applications addressing authentication, registration, account management as well as 3rd party (social) account authentication.

Supported Flows

  • Signup of both local and social accounts
  • Connecting more than one social account to a local account
  • Disconnecting a social account -- requires setting a password if only the local account remains
  • Optional instant-signup for social accounts -- no questions asked
  • E-mail address management (multiple e-mail addresses, setting a primary)
  • Password forgotten flow
  • E-mail address verification flow

Supported Providers

  • Dropbox (OAuth)
  • Facebook (both OAuth2 and JS SDK)
  • Github
  • Google (OAuth2)
  • LinkedIn
  • OpenId
  • Persona
  • SoundCloud (OAuth2)
  • Stack Exchange (OAuth2)
  • Twitch (OAuth2)
  • Twitter
  • Weibo (OAuth2)

Django Social Auth


Django Social Auth is an easy way to setup social authentication/authorization mechanism for Django projects.

Crafted using base code from django-twitter-oauth and django-openid-auth, it implements a common interface to define new authentication providers from third parties.

Supported Providers

  • Google OpenID
  • Google OAuth
  • Google OAuth2
  • Yahoo OpenID
  • OpenId like myOpenID
  • Twitter OAuth
  • Facebook OAuth

Django-Socialauth


What it does

  1. Allow logging in via various providers.
  2. Import contacts from various third party sites, to find out which of your friends already use our service.

Logging In

This is a application to enable authentication via various third party sites. In particular it allows logging in via

  • Twitter
  • Gmail
  • Facebook
  • Yahoo(Essentially openid)
  • OpenId

oauth2app


The oauth2app module helps Django site operators provide an OAuth 2.0 interface. The module is registered as an application.

django-oauth


This is a forked version of David Larlet's django-oauth.

One very important difference is that this version requires that you be running a real cache behind Django's caching framework.

django-oauth-access


Supported Providers

  • Twitter
  • LinkedIn
  • Yahoo
  • Facebook (using OAuth 2.0 — it is functional, but needs more work)
  • Likely any OAuth 1.0a compliant site

django-oauth-consumer


A django application providing infrastructure for consuming OAuth services. It is not for providing OAuth services.


Also useful:

  • http://developers.facebook.com/docs/guides/web/#login
  • http://developers.facebook.com/docs/guides/canvas/#auth
  • https://github.com/dgouldin/python-oauth2
  • https://github.com/henriklied/django-twitter-oauth
  • https://launchpad.net/django-openid-auth
  • https://www.djangopackages.com/grids/g/oauth/
  • http://peterhudec.github.io/authomatic/examples/django-simple.html



回答2:


I highly recommend using django-social-auth. The README is very complete, and it also includes information for authenticating against other OAuth sources such as twitter, and against OpenID sources like Google and Yahoo. Of course, if you just wanted Facebook authentication, you can just use it for that.

There's also an included example application, which gives you some sample code to play with.




回答3:


FOR MOBILE APPLICATION, if you are developing an application for ios/android with django in the backend, what you can do is login to facebook in the frontend using the facebook ios/android api. But this is not the final login for your app. Upon facebook-login, facebook gives you an access token which you can then send to your django backend along with your facebook username/email. In the back, django can use something like facebook python sdk to verify the username-access token pair by communicating with facebook. If verified, you can finally log in the user for your app.

Using the python sdk is easy, just read the tutorial and you will be communicating with facebook in seconds.




回答4:


The new way of doing that is by using python-social-auth, as django-social-auth was deprecated in favor of python-social-auth and now supports other frameworks than Django such as Flask, Pyramid, Web.py and Tornado.

It also supports other major auth providers such as Microsoft, Google, Twitter, Amazon, GitHub and many more.

Here is a quick get-started way to configure it on Django: How to sign in with the Google+ API using Django?




回答5:


I can totally recommend django-allauth. It just works!



来源:https://stackoverflow.com/questions/5530277/how-to-make-facebook-login-possible-in-django-app

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!