Skip to content

Django restful API for custom authentication with mobile or email using OTP verification

Notifications You must be signed in to change notification settings

harryanand060/django_rest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

34 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Restful API For Custom Authentication

Django restful api login with Email and Mobile no. In this we get custom created authentication system. We can register with our mobile or email after register verification OTP sent to email and mobile. Both email and mobile has different OTP. so when user input the OTP from email then email verified and if OTP input from mobile then mobile varified. User also sent the resent OTP if mail or SMS not found.

Docs

https://github.com/harryanand060/django_rest/wiki

Branch

development:

compatible with >=django 3.0

Master:

compatible with django2.0

django_v3:

compatible with >=django3.0

Installation

  1. Download or clone project from git.

    for WINDOWS Install Git Bash

    https://git-scm.com/downloads

    after install the Git Bash

    git clone https://github.com/harryanand060/django_rest.git

  2. Create project with virtual environment also install pip pip.

  3. Install prerequisites

       pip isntall -r requirement.txt

(after coping the project to your directory where you create projcet).

  1. Inside app we have .env.test rename to .env and then update

    Generate SECRET_KEY

    python manage.py generate_key -sp -d app

    Database Settings

     DATABASE_NAME=db_name
     DATABASE_USER=root
     DATABASE_PASSWORD=
     DATABASE_HOST=localhost
    

    EMAIL Setting

    EMAIL_HOST_USER = '***@gmail.com' EMAIL_HOST_PASSWORD = ''.

    SMS Getway Setting

    'url': 'http://sms.abc.com/sendSMS', 'apikey': '**********************', 'username': '', 'sendername': '', 'smstype': '********'.

  2. now open terminal and path set to your current project and run

        python manage.py makemigrations
        python manage.py migrate
  3. now create super user

    ```bash
         python manage.py createsuperuser
    ```
    

    and follow the steps.

  4. now Run

        python manage.py runserver

#Testing

img.png

Open the browser with given runserver IP for ex: http://127.0.0.1:8000/ Here you get all the listed API Docs