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
```python
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.7.tar.gz
(2.6 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.7.tar.gz.
File metadata
- Download URL: securely-0.1.7.tar.gz
- Upload date:
- Size: 2.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.0.1 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ef92fb59d45e42d9754d27573159d02f27824aade357782b951bf8df5020bfdf
|
|
| MD5 |
1c0812eaaf515ca5a8da1c01f2e88604
|
|
| BLAKE2b-256 |
4631d54c77e4f586a7ec6a07a637943f1484a241be177dcfa5c934ad35968a8d
|
File details
Details for the file securely-0.1.7-py3-none-any.whl.
File metadata
- Download URL: securely-0.1.7-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 |
cd0c02e3747fd4a024b6febe77eedcb92c3db825cba745e2f0da18b138a6aa45
|
|
| MD5 |
819070c8de82dc6aab9aebd1ad90644f
|
|
| BLAKE2b-256 |
89973891fc8ca3d1dcb89fde6954666babeb80e65c6d5a4e9be7e6539d598733
|