Django-AuthAPI-with-JWT is an authentication API for Django applications using Django Rest Framework (DRF) and JSON Web Tokens (JWT). It provides functionality for user registration, login, password management, and password reset via email.
- User Registration: Allow users to create an account by providing necessary information.
- User Login: Authenticate users and issue JWT tokens upon successful login.
- Change Password: Enable users to change their account passwords.
- Password Reset via Email: Send password reset emails to users for account recovery.
- Clone the repository:
https://github.com/rifatjamil54/Django-AuthAPI-with-JWT.git
- Change directory:
cd Django-AuthAPI-with-JWT
- Create a virtual environment (recommended):
python -m venv venv
- Activate the virtual environment:
- On Windows:
venv\Scripts\activate
- On macOS and Linux:
source venv/bin/activate
- Install dependencies:
pip install -r requirements.txt
- Change directory:
cd AuthAPI
- Configure settings:
Edit the settings.py
file to configure your database, email settings, and other necessary options.
- Apply migrations:
python manage.py makemigrations
python manage.py migrate
- Run the development server:
python manage.py runserver
The authentication API should now be accessible at http://127.0.0.1:8000/
.
- Registration:
Send a POST request to http://127.0.0.1:8000/account/register/
with user registration details to create a new account.
- Login:
Send a POST request to http://127.0.0.1:8000/account/login/
with login credentials to receive a JWT token for authentication.
- Change Password:
Send a POST request to http://127.0.0.1:8000/account/changepass/
with the new password to change the user's password.
- Password Reset via Email:
Send a POST request to http://127.0.0.1:8000/account/send-email-rest-password/
with the user's email address to initiate a password reset process. An email with reset instructions will be sent to the user.
- Profile:
Send a GET request to http://127.0.0.1:8000/account/profile/
with the user's profile see user details.
- Rest-Password:
Send a POST request to http://127.0.0.1:8000/account/rest-password/<uid>/<token>/
with the rest-password to change the user's password.