HOTOSM SSO authentication library for Hanko + OSM OAuth
Project description
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
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
hotosm_auth-0.2.6.tar.gz
(104.9 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 hotosm_auth-0.2.6.tar.gz.
File metadata
- Download URL: hotosm_auth-0.2.6.tar.gz
- Upload date:
- Size: 104.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1d9fcfd693622a514cd00a1d84898dee8ecabb7e2e11319f40ba936f93823873
|
|
| MD5 |
bacdccfec913bbec9e00780afb22dc91
|
|
| BLAKE2b-256 |
f4d845eaa1366f79dd82afb2faa326a7c4074ef987cf463828686e2bd14376ea
|
File details
Details for the file hotosm_auth-0.2.6-py3-none-any.whl.
File metadata
- Download URL: hotosm_auth-0.2.6-py3-none-any.whl
- Upload date:
- Size: 46.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b17c4cd87bbe96581b83351cacde11d75a60378b9c13121cfbcea9dc6be9c684
|
|
| MD5 |
9b3cd18a9ad7739fb6a4c0eabcf03523
|
|
| BLAKE2b-256 |
846fcce057ddc254c37e8ce1f0b13d2a2603e24e5b9781cf64f400aaa9d8410d
|