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.8.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.8.tar.gz.
File metadata
- Download URL: securely-0.1.8.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 |
719f6070cfbd8e5f51d92ac421b887dc6514907ef002b0b9cdfd6b2818ccb7ca
|
|
| MD5 |
b17c63e14cdd59986cc579f0633548e0
|
|
| BLAKE2b-256 |
3a062eefac2a92fe617f1baabd8aef0ab051deecee3dec9e9d58aa241b13c87b
|
File details
Details for the file securely-0.1.8-py3-none-any.whl.
File metadata
- Download URL: securely-0.1.8-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 |
ff5cf85ae397b889dbb771c7ea85a3bd6ce708fd173f3eab50577a3c03fe42bf
|
|
| MD5 |
5296a5f41b7c6ec02bd99a29f4ddc78e
|
|
| BLAKE2b-256 |
66c112540110bf098c042da8422335abb71612c6d2846d1b4a62f00a0923708d
|