I am trying to add email authentication with python-social-auth.
Documentation says that:
Form submit should go to /complete/email, or if it goes to your view, then your view should complete the process calling social.actions.do_complete
In my case, the form goes to my own view and at the end I should call do_complete. I searched a lot but was not able to find any documentation on this method. I looked at the source code and the definition is:
def do_complete(backend, login, user=None, redirect_name='next',
*args, **kwargs)
But how do I give this method all those parameters, i.e. backend, login(what is login?) and etc from my django view?
What you can do is load your backend manually like this:
from social.apps.django_app.utils import load_strategy, load_backend
strategy = load_strategy(self.request)
backend = load_backend(strategy, 'username', "social:complete")
where username is the name of backend and then call do_complete like this:
do_complete(backend, login, user)
where backend is your previously obtained backend, login is a login function (look at _do_login function from social.apps.django_app.views) and user is your user instance, which you have create/authenticated etc in your view.
Hope this helps someone in the future
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With