Welcome to the Authentication API project. This project is a simple API that allows users to register, login, logout, change password, reset password, change email, and verify email. The API is built with Django and Django Rest Framework.
The API is built with the following technologies:
- Django
- Django Rest Framework
- Djoser
- Social_django
The API is built with the following features:
- User Registration
- User Login
- User Logout
- User Account Activation
- User Password Change
- User Password Reset
- User Email Change
- User Email Change Verification
To run the project, follow the instructions below:
- Clone the repository
git clone https://github.com/faresemad/Authentication-API.git
- Change into the project directory
cd Authentication-API
- Create a virtual environment
python3 -m venv venv
- Activate the virtual environment
source venv/bin/activate
- Install the project dependencies
pip install -r requirements/local.txt
- Build the project
make build
- Run the project
make up
- Access the project on your browser
http://localhost:8000
you can access the API endpoints on your browser by visiting the following URL:
http://localhost:8000/api/docs/
you can access the social endpoints on your browser by visiting the following URL:
-
Google:
http://localhost:8000/api/auth/o/google-oauth2/?redirect_uri=http://localhost:8000/api/social-auth/complete/google-oauth2/
- Notes:
- You need to set redirect URI in the Google Developer Console to
http://localhost:8000/api/social-auth/complete/google-oauth2/
- You need to set the following environment variables in the
.env
(this file must be in.envs/
directory) file:SOCIAL_AUTH_GOOGLE_OAUTH2_KEY
SOCIAL_AUTH_GOOGLE_OAUTH2_SECRET
- You need to set the following Settings in Djoser Settings:
DJOSER = { # ... "LOGIN_FIELD": "email", "SOCIAL_AUTH_TOKEN_STRATEGY": "djoser.social.token.jwt.TokenStrategy", "SOCIAL_AUTH_ALLOWED_REDIRECT_URIS": [ "http://localhost:8000/api/social-auth/complete/google-oauth2/", ], # ... }
- You need to set redirect URI in the Google Developer Console to
- Notes:
-
Twitter:
http://localhost:8000/api/auth/o/twitter/?redirect_uri=http://localhost:8000/api/social-auth/complete/twitter/
- Notes:
- You need to set redirect URI in the Twitter Developer Portal to
http://localhost:8000/api/social-auth/complete/twitter/
- You need to set the following environment variables in the
.env
(this file must be in.envs/
directory) file:SOCIAL_AUTH_TWITTER_KEY
SOCIAL_AUTH_TWITTER_SECRET
- You need to set the following Settings in Djoser Settings:
DJOSER = { # ... "SOCIAL_AUTH_ALLOWED_REDIRECT_URIS": [ # ... "http://localhost:8000/api/social-auth/complete/twitter/", ], # ... }
- You need to set redirect URI in the Twitter Developer Portal to
- Notes:
-
GitHub:
http://localhost:8000/api/auth/o/github/?redirect_uri=http://localhost:8000/api/social-auth/complete/github/
- Notes:
- You need to set redirect URI in the GitHub Developer Portal to
http://localhost:8000/api/social-auth/complete/github/
- You need to set the following environment variables in the
.env
(this file must be in.envs/
directory) file:SOCIAL_AUTH_GITHUB_KEY
SOCIAL_AUTH_GITHUB_SECRET
- You need to set the following Settings in Djoser Settings:
DJOSER = { # ... "SOCIAL_AUTH_ALLOWED_REDIRECT_URIS": [ # ... "http://localhost:8000/api/social-auth/complete/github/", ], # ... }
- You need to set redirect URI in the GitHub Developer Portal to
- Notes:
-
LinkedIn:
http://localhost:8000/api/auth/o/linkedin-oauth2/?redirect_uri=http://localhost:8000/api/social-auth/complete/linkedin-oauth2/
- Notes:
- You need to set redirect URI in the LinkedIn Developer Portal to
http://localhost:8000/api/social-auth/complete/linkedin-oauth2/
- You need to set the following environment variables in the
.env
(this file must be in.envs/
directory) file:SOCIAL_AUTH_LINKEDIN_OAUTH2_KEY
SOCIAL_AUTH_LINKEDIN_OAUTH2_SECRET
- You need to set the following Settings in Djoser Settings:
DJOSER = { # ... "SOCIAL_AUTH_ALLOWED_REDIRECT_URIS": [ # ... "http://localhost:8000/api/social-auth/complete/linkedin-oauth2/", ], # ... }
- You need to set redirect URI in the LinkedIn Developer Portal to
- Notes: