This package will help you while authorization and authentication in fastapi
Project description
Source code:https://github.com/coderxuz/securely
Securely
Securely is a Python package that helps with authentication and authorization in FastAPI applications.
Installation
You can install the package via pip:
pip install securely
Quick start
from securely import Auth
from fastapi import FastAPI
from datetime import timedelta
app = FastAPI()
auth = Auth(
secret_key="bla bla",
access_token_expires=timedelta(days=1),
refresh_token_expires=timedelta(days=7),
)
just_db = [{"username": "john", "password": "gdfdfgdgdrgdr"}]
@app.post("/login")
async def login(data: dict):
new_user = {"username": data.get("username")}
new_user["password"] = auth.hash_password(password=data.get("password"))
just_db.append(new_user)
tokens = auth.create_tokens(subject=new_user.get("username"))
return tokens
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
securely-0.1.9.tar.gz
(2.7 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file securely-0.1.9.tar.gz.
File metadata
- Download URL: securely-0.1.9.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a988e42db732dca42b2bb9f1e252fcf1265378ac9cc3419760e38679ec75b04
|
|
| MD5 |
a3a6eed3eaf7c9ad27b275fbee65f7df
|
|
| BLAKE2b-256 |
71fe97e3be62730935c285770b75cc1b6d5ac6c1cf005ec80930cb1ce69db866
|
File details
Details for the file securely-0.1.9-py3-none-any.whl.
File metadata
- Download URL: securely-0.1.9-py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
988155be7bae642624b0df227745119f919da8a849d1d9c4ef75e1a0ac390c47
|
|
| MD5 |
fb23ec86f705af6c7ce5edc76311a261
|
|
| BLAKE2b-256 |
0d9d1fd8aa54d0c77908641e53b3f1483e270a0837fbfd1feede5df6f6778d7c
|