Git Product home page Git Product logo

django_sms_login's Introduction

Django password less login

An API based Django dashboard login with no password and a four digit SMS verification

This repository is an implementation of an API used to generate a four digit which can be sent to the user via SMS for authentication. It doesn't use the restAPI framework but the endpoints are handled in the Django sms_login app view.

The API has four endpoints:

  • api/login/create
  • api/login/verify
  • api/login/auth
  • api/login/unauth

Usage:

Create a four digit code:

The api/login/create receives POST request with a phone number and if the number doesn't exist in the users table, it is inserted. A random four digit code is generated and stored in the database.The payload should look like:

{
   "phone_number":"09123456789"
 } 

Verify the four digit code:

A POST request with the phone number and the verification code should be sent to the api/login/verify endpoint to receive an authorization token. The payload for this endpoint looks something like:

{
    "verification_code":"1081",
    "phone_number":"09123456789"
}

And the response includes the token:

{
    "status": 200,
    "verified": true,
    "token": "1651b34546b9d9e95394b5f07dd2ef8a2e66f671dee7d7e956067a1148bcc8c2"
}

Login

By navigating to the api/login/auth (making a GET request) with the token in the header the user can be logged in as the newly created user. For the above example the header sholud include the token as so: TOKEN:1651b34546b9d9e95394b5f07dd2ef8a2e66f671dee7d7e956067a1148bcc8c2

Logout

Logging out is done by navigating to the api/login/unauth endpoint.

django_sms_login's People

Contributors

pharzan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

salimzadeh

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.