tschellenbach / Django-facebook

Facebook open graph api implementation using the Django web framework in python
http://www.mellowmorning.com/
Other
1.43k stars 543 forks source link

Question understanding how `auth_backends` work #598

Open maxwyb opened 7 years ago

maxwyb commented 7 years ago

I am new to Django and am trying to understand how the customized authentication backend works in this case (Sorry if the question is too simple). In django_facebook/auth_backends.py, we have an authenticate function with facebook_id and facebook_email as parameters.

def authenticate(self, facebook_id=None, facebook_email=None):

However, according to Django's official documentation:

The authenticate method takes a request argument and credentials as keyword arguments. Most of the time, it’ll just look like this:

class MyBackend(object):
def authenticate(self, request, username=None, password=None):
# Check the username/password and return a user.
...

So the method signature does not match Django's specification; how does it work correctly?

Also, I did notice that in django_facebook/registration_backends.py, there is another authentication function in class FacebookRegistrationBackend(NooptRegistrationBackend) that matches the documentation. Is this related to the authentication backend? And what is the relation between an "authentication backend" and a "registration backend"?

Thanks, appreciate your help!