Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deepmancer/flask-authentication-service
Simple Flask-based authentication service providing user login, registration, and token management with MongoDB integration.
https://github.com/deepmancer/flask-authentication-service
async flask flask-application jwt-authentication mongodb python3 simple-project
Last synced: 14 days ago
JSON representation
Simple Flask-based authentication service providing user login, registration, and token management with MongoDB integration.
- Host: GitHub
- URL: https://github.com/deepmancer/flask-authentication-service
- Owner: deepmancer
- Created: 2021-02-27T06:58:05.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-08-16T11:28:38.000Z (3 months ago)
- Last Synced: 2024-10-11T20:04:30.280Z (28 days ago)
- Topics: async, flask, flask-application, jwt-authentication, mongodb, python3, simple-project
- Language: Python
- Homepage:
- Size: 40 KB
- Stars: 3
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# π Simple Flask Authentication Service
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.
---
### π Key Features
- **π User Login:** Securely authenticate users with password verification.
- **π User Registration:** Effortlessly create new user accounts.
- **π« Token Generation:** Issue secure tokens upon successful login for access control.
- **β³ Token Expiration:** Manage token validity to enhance security.
- **π Language Agnostic:** Seamlessly integrates with projects in any programming language.
- **πΎ MongoDB Integration:** Uses MongoDB and an Object-Document Mapper (ODM) for reliable data persistence.### π Getting Started
#### π Prerequisites
Ensure you have the following:
- Python 3.6 or later ([Download Python](https://www.python.org/))
- Flask web framework ([Check Flask](https://flask.palletsprojects.com/))
- MongoDB database ([Explore MongoDB](https://www.mongodb.com/))#### πββοΈ Running the Service
1. **Clone the Repository:**
```bash
git clone https://github.com/your-username/flask-authentication-service.git
```2. **Navigate to the Project Directory:**
```bash
cd flask-authentication-service
```
3. **Install Dependencies:**```bash
pip install -r requirements.txt
```4. **Start the Server:**
```bash
python server.py
```5. **Access the Service:**
Your authentication service will be available at `localhost:9999` (port is customizable).### π‘ API Endpoints
| **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). |### π‘ Example Usage (with cURL)
**Login:**
```bash
curl -X POST -H "Content-Type: application/json" -d '{"id": "your_user_id", "password": "your_password"}' http://localhost:9999/login
```**Register:**
```bash
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! π