This is a simple Flask project demonstrating user login and registration functionality with JWT authentication.
- User registration
- User login
- Password hashing and verification
- JWT token generation
- Protected routes
- Python 3.x
- Flask
- Flask-JWT-Extended
- SQLAlchemy
-
Clone the repository:
git clone https://github.com/yourusername/flask-auth-project.git cd flask-auth-project
-
Create and activate a virtual environment:
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install the required packages:
pip install -r requirements.txt
-
Set up the database:
flask shell >>> from app1 import db >>> db.create_all() >>> exit()
-
Run the application:
FLASK_APP=app1.py flask run
Configuration settings are stored in config.py
. Update this file with your database settings and any other configuration settings as needed.
Endpoint: /register
Method: POST
Request Body:
{
"username": "your_username",
"password": "your_password"
}