Skip to content

devmahmud/django_react_social_login

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Django React Social Login

This web-application demonstrates social authentication (Google, Facebook OAuth as an example) with Django Rest Framework and React.

Installation

Change the directory to core, setup & activate virtual environment:

cd core
python3 -m venv venv
source venv/bin/activate

Install the backend server dependency:

pip install -r requirements.txt

Make migrations & Migrate the db:

python manage.py makemigrations
python manage.py migrate

Create a superuser:

python manage.py createsuperuser

Run the server & login to http://127.0.0.1:8000/admin :

python manage.py runserver

Change/add the domain from SITES then add social application under SOCIAL_ACCOUNTS. You can obtain CLIENT_ID and SECRET_KEY for Google from https://console.developers.google.com and for Facebook https://developers.facebook.com/

Now it's time to setup the frontend

Change the terminal directory to frontend:

cd frontend

Change the appId & clientId in src/App.js

Install the frontend app dependency & run the application:

yarn install
yarn start

Now you should see two login buttons one for Google login & another for Facebook.