How to integrate Social Authentication in a Django Rest back-end project

Hi Guys,
Currently, I am building a stable back-end where I have to use social authentication. I am using Django-rest-framework for building the Restful API. For implementing social authentication, I am trying to use Django REST Framework Social OAuth2 but provided documentation is not driving me properly. Need some light on it, maybe documentation or a repository or another package with good documentation.

1 Like

Hi Dipto,

I’m currently also working on a project where I have enabled social auth.

My recommendation would be to start with setting up Python Social Auth and get this working first, independently of the DRF integration. The basic setup is simple, but connecting all the dots requires a bit of reading and it can he challenging to grasp what all the different packages are exactly doing and how they integrate with each other and how to test the configuration.

To get started with Python Social Auth and the Django integration, I found one article on the topic particularly useful: “ How to Add Social Login to Django” by Vitor Freitas from 2016 - especially the very simple templates to test the configuration could be helpful.
The URLs and how they are being used could probably be documented a little bit more clearly in the main documentation. Some overview is provided on Python Social Auth documentation > Beginners Guide > Understanding PSA URLs.

I’m not entirely sure, but if I remember correctly, some details have changed, but with the documentation and the article, I got the basic social logins working.

I can’t help you yet with any details about django-rest-framework-social-oauth2, but maybe looking at the article helps you at least with the first step, setting up social and and authenticating users from social backends via “normal” Django views.

Kind regards,
Goetz

1 Like

Thank you so much @goetzb. Yeah, I am also thinking to use Python Social Auth. Those resources will really help me on that.