HOTOSM Auth Library - Python
FastAPI/Django integration for Hanko authentication with OSM OAuth support.
Installation
pip install hotosm-auth
Usage
FastAPI
from fastapi import FastAPI, Depends
from hotosm_auth.integrations.fastapi import CurrentUser
app = FastAPI()
@app.get("/me")
async def get_me(user: CurrentUser):
return {"id": user.id, "email": user.email}
Django
from django.http import JsonResponse
from hotosm_auth.integrations.django import require_auth
@require_auth
def my_view(request):
return JsonResponse({"user_id": request.user.id})
Features
- JWT validation for Hanko tokens
- OSM OAuth 2.0 integration
- User mapping between Hanko and application users
- FastAPI and Django integrations
Configuration
Set these environment variables:
HANKO_API_URL=https://login.hotosm.org
OSM_CLIENT_ID=your_osm_client_id
OSM_CLIENT_SECRET=your_osm_secret
COOKIE_SECRET=your_secret_key
License
AGPL-3.0
Metadata
Release files for hotosm-auth-dev 0.2.5
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| hotosm_auth_dev-0.2.5.tar.gz | 104.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| hotosm_auth_dev-0.2.5-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 150.9 kB
Release files / hotosm_auth_dev-0.2.5.tar.gz
| Download URL | hotosm_auth_dev-0.2.5.tar.gz |
|---|---|
| Size | 104.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b41f3d726e0a0e6c17270d38cf264376165102f4708248dff7a6dea6790748ed
|
|
BLAKE2b-256 checksum How to use checksums |
bc74624e76774ee349858ba7ed6012369460a6b806988f12edcb2f125c560bc4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.17
|
Release files / hotosm_auth_dev-0.2.5-py3-none-any.whl
| Download URL | hotosm_auth_dev-0.2.5-py3-none-any.whl |
|---|---|
| Size | 46.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6ac9529fd1601480cc12a716bb9db0e61263ec99c28fa3e1799dda4520d1f9a8
|
|
BLAKE2b-256 checksum How to use checksums |
caad54e9ca1efb469603b8c123f036067e27d2f02c9e787183df4c37261e467e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.10.17
|