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
```markdown
```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.5.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.5.tar.gz.
File metadata
- Download URL: securely-0.1.5.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 |
f31f38d1a99a8a2c97db73f00a4a7f0f7faf2b6d9a2a010e6845bed578f17031
|
|
| MD5 |
23caf1f0a655d3045fa9ff569f689db5
|
|
| BLAKE2b-256 |
492384d838ca9659d61056f1e355807b3ad9c364bca7964f73f0f03ae1f5e78e
|
File details
Details for the file securely-0.1.5-py3-none-any.whl.
File metadata
- Download URL: securely-0.1.5-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 |
81390c2e8ca466041d5261e29474166fee358fbb2def9df0f8591bbeaf3104d8
|
|
| MD5 |
13e718a69335125b257310c4d07eaa8b
|
|
| BLAKE2b-256 |
186f8ac56d568cfc47b3ae461c83456a4df45e60a938a7c459b4fb1b1c3bc05d
|