I have to implement some REST api for mobile application.
I would to use Django REST framework.
The user (mobile side) can register an account only using Facebook, I would to use python-social-auth for this registration / login.
I'm new for this so I seen a lot of tutorial / documentations / example about it.
I have found only complete tutorial about Django + python_social_auth but I would to know exactly the best practice to make a user registration / login with REST-api.
Where can I found a complete example?
In my simple test I have also a problem: When I try to use this example:
@psa('social:complete')
def register_by_access_token(request, backend):
# This view expects an access_token GET parameter, if it's needed,
# request.backend and request.strategy will be loaded with the current
# backend and strategy.
token = request.GET.get('access_token')
user = request.backend.do_auth(request.GET.get('access_token'))
if user:
login(request, user)
return 'OK'
else:
return 'ERROR'
I obtain this error:
u'social' is not a registered namespace
I tried also to add this SOCIAL_AUTH_URL_NAMESPACE = 'myApp'
in my settings but it not solve the problem.
If it's not too late then why not use https://github.com/pennersr/django-allauth and https://github.com/Tivix/django-rest-auth which are designed to work together and simplify API based (social)login / logout / password reset token / password reset from token etc flows.