Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How to add social login to django rest framework?


Asked by Sariyah Montgomery on Dec 02, 2021 Django



Integrating a social login implementation to your backend requires only 3 steps; 1. Select the desired social network provider. i.e facebook, google, twitter, github. 2. Send a log in request to the social network provider. 3. Register and login the user. 4.
Furthermore,
You can create social login using social-auth-app-django for Facebook, Twitter, GitHub, Google, Tumblr, etcs. Here is List. Find this project on GitHub Also.
Consequently, This module provides OAuth2 social authentication support for applications in Django REST Framework. The aim of this package is to help set up social authentication for your REST API. It also helps setting up your OAuth2 provider. This package relies on python-social-auth and django-oauth-toolkit .
Next,
If you want to enable a social backend (e.g. Facebook), check the docs of python-social-auth on supported backends and django-social-auth on backend configuration. Now that the installation is done, let's try out the various functionality. We will assume for the following examples that the REST API is reachable on http://localhost:8000.
In this manner,
With django rest frameworkyou already familiar. The allauthis responsible for the social authentication. The django-rest-authresponsible for create the RESTful api for the social authentication, i.e. the connection between django-rest-framework and allauth.