auth user
Project description
Default auth service based on FastApi framework
Installation
$ pip install fastapi-auth-user
or
for poetry:
$ poetry init
$ poetry add fastapi-auth-user
Example
Create it
- Create a file
main.py
with:
import uvicorn
from fastapi_auth_user import auth_app
if __name__ == "__main__":
uvicorn.run(auth_app, host="localhost", port=3000)
Run it
Run the server with:
$ poetry run main.py or $ python3 main.py
INFO: Started server process [12484]
INFO: Waiting for application startup.
INFO: Application startup complete.
INFO: Uvicorn running on http://localhost:3000 (Press CTRL+C to quit)
Check it
Open your browser at http://localhost:3000/docs.
You will see:
You already created an API that:
- All method CRUD for USER model`.
- All method CRUD for Role model`.
- Login user with oauth2
- Profile this user
Env file
DB_USER=<YOU USER NAME DB> #'postgres'
DB_PASSWORD=<YOU DATABASE PASSWORD> #'root'
DB_HOST=<YOU DATABASE HOST> #'localhost'
DB_NAME=<YOU DATABASE NAME> #'auth_db'
DATABASE_URL=<YOU DATABASE URL> #'postgresql://${DB_USER}:${DB_PASSWORD}@${DB_HOST}/${DB_NAME}'
ACCESS_TOKEN_EXPIRE_MINUTES=<TIME FOR TOKEN> #30
SECRET_KEY=<SECRET KEY> #'secret_key'
ALGORITHM=<HASH ALGORITHM> #'HS256'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastapi_auth_user-0.1.2.9.tar.gz
(14.7 kB
view details)
Built Distribution
File details
Details for the file fastapi_auth_user-0.1.2.9.tar.gz
.
File metadata
- Download URL: fastapi_auth_user-0.1.2.9.tar.gz
- Upload date:
- Size: 14.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.0 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ecf86c8954797117a2d1f1da834e1096df13185a69dc58fc63917a9450feec48 |
|
MD5 | 96447ffd64150ddfeb049594db68d2c5 |
|
BLAKE2b-256 | cdb017fbad5e31ddce95ff233950c90822b3fb366308c6a5d09baf619c1b6925 |
File details
Details for the file fastapi_auth_user-0.1.2.9-py3-none-any.whl
.
File metadata
- Download URL: fastapi_auth_user-0.1.2.9-py3-none-any.whl
- Upload date:
- Size: 23.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.3.2 CPython/3.11.0 Windows/10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 606889a07ca2cb9d1218523816ee08b1ee57063ffea945fe0b3bd78284c2c026 |
|
MD5 | 5ad0b5827396a7896657ff674000113b |
|
BLAKE2b-256 | c6a76a59f0f046b5a0df90eeea7c36295bbabdd8eaa94271c4ea4cf409acd449 |