Skip to main content

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


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.8.tar.gz (98.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

hotosm_auth-0.2.8-py3-none-any.whl (46.1 kB view details)

Uploaded Python 3

File details

Details for the file hotosm_auth-0.2.8.tar.gz.

File metadata

  • Download URL: hotosm_auth-0.2.8.tar.gz
  • Upload date:
  • Size: 98.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.17

File hashes

Hashes for hotosm_auth-0.2.8.tar.gz
Algorithm Hash digest
SHA256 69414033608ff9a8fdbdd5a316976de38355f825df8c1a07cbad6bb9aef0a0dc
MD5 84c353f13893c9a50692a4362416fe4e
BLAKE2b-256 4270912ac84c163a143f208079a581a3e26ca72ac93daefe7e7d559355f3c3de

See more details on using hashes here.

File details

Details for the file hotosm_auth-0.2.8-py3-none-any.whl.

File metadata

  • Download URL: hotosm_auth-0.2.8-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

Hashes for hotosm_auth-0.2.8-py3-none-any.whl
Algorithm Hash digest
SHA256 4f803af31908ffbebfaea15b345f390684fa5c3dfe2b03587f3d4d05c68b955c
MD5 0fd1eef1341ebb6b962387322a0ed440
BLAKE2b-256 f4bcbbb37101e4b8c40638bba09a842a62d95f6527e8e9b8ac6c1a23c20ec625

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page