Last year I wrote a guide for django-allauth, and now it’s time for DRF. I will be using drf-social-oauth2 for social authentication.
As far as I understood this is a collaboratory project, and it is currently maintained by Wagner De Lima.
You can find very useful materials here and there, but the purpose behind this tutorial is to help set up social authentication for your DRF-based API by following clear and easy steps. So that nobody suffers from the lack of base knowledge or the lack of time – been there, done that.
Table of contents:
1. Registering an app in Facebook and Google developer’s panels
2. Getting User Access Token from Facebook/Google
2.1 Facebook
2.2 Google
3. Installing drf-social-oauth2
3.1 settings.py
3.2 Facebook
3.3 Google
4. Creating a local app
5. Converting Token from Facebook/Google into a DRF Access token
6. Accessing things with this new Token
7. Refreshing Access Token
8. Changing Access Token Expiration