Simple Flask-based authentication service providing user login, registration, and token management with MongoDB integration.
Welcome to your new go-to Flask-based authentication service! This streamlined solution offers a robust foundation for mastering authentication essentials. With built-in features like user login, registration, token management, and MongoDB integration, itβs designed to be user-friendly and versatile.
Ensure you have the following:
Clone the Repository:
git clone https://github.com/your-username/flask-authentication-service.git
Navigate to the Project Directory:
cd flask-authentication-service
Install Dependencies:
pip install -r requirements.txt
Start the Server:
python server.py
Access the Service:
Your authentication service will be available at localhost:9999
(port is customizable).
Method | Path | Description |
---|---|---|
POST |
/login |
Login a user and obtain a token (provide id and password in the request body). |
POST |
/register |
Register a new user (provide id and password in the request body). |
POST |
/getUserIdWithToken |
Retrieve the user ID associated with a specific token (provide token in the request body). |
POST |
/isTokenExpired |
Check if a token has expired (provide token in the request body). |
Login:
curl -X POST -H "Content-Type: application/json" -d '{"id": "your_user_id", "password": "your_password"}' http://localhost:9999/login
Register:
curl -X POST -H "Content-Type: application/json" -d '{"id": "new_user_id", "password": "new_user_password"}' http://localhost:9999/register
Feel free to explore, customize, and make this service your own. Happy coding! π