Giter VIP home page Giter VIP logo

auth_system's Introduction

Auth System

This is a project that demonstrates how you could implement a fully featured JSON Web Token Authentication system in Django and React. This includes showing how to implement features like account activation, password reset, and also social authentication with google and facebook oauth2. Further improvements to make it more production ready would just be to utilize the refresh token to get a new access token when the application reloads and also reloads when you go to an important page such as a checkout page, and having alerts present on the frontend to make things more user friendly.

In order to test out this project, follow these steps:

  • clone the repository
  • in the frontend folder, run: npm install, this will install the required frontend packages
  • in the frontend folder, run: npm run build, this will make a build folder and copy it into the backend folder
  • in the backend folder, run: python3 -m venv venv
  • then activate the virtual environment
  • in the backend folder, run: pip install -r requirements.txt

Then under backend/auth_system/settings.py:

  • under DATABASES, set the PASSWORD field to your database password
  • under EMAIL_HOST_USER, set the email that you want to use
  • under EMAIL_HOST_PASSWORD, set the app password that you setup for your email
  • under SOCIAL_AUTH_GOOGLE_OAUTH2_KEY, paste in your google oauth2 key
  • under SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET, paste in your google oauth2 secret
  • under SOCIAL_AUTH_FACEBOOK_KEY, paste in your facebook oauth2 key
  • under SOCIAL_AUTH_FACEBOOK_SECRET, paste in your facebook oauth2 secret

If you get an error when using social authentication that says "ModuleNotFoundError: No module named 'django.utils.six", then do the following:

  • Open the file "venv/lib/python3.X/site-packages/djoser/social/token/jwt.py"
  • Change the line "from django.utils.six import text_type" to "from six import text_type"
  • With this change you should be able to log in using Google and Facebook OAuth2

auth_system's People

Contributors

brkicb avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.