Skip to main content

datasette-auth-osm

PyPI Tests License

Datasette plugin that authenticates users against OpenStreetMap

Installation

Install this plugin in the same environment as Datasette.

datasette install datasette-auth-osm

Demo

You can try this out at datasette-auth-osm.madflex.de - click on the top right menu icon and select "Sign in with OpenStreetMap".

Initial configuration

First, create a new application in Openstreetmap - OAuth2 Applications. You will need the client ID and client secret for that application.

Add http://127.0.0.1:8001/-/osm-callback to the list of Allowed Callback URLs.

Then configure these plugin secrets using metadata.yml:

plugins:
  datasette-auth-osm:
    client_id:
      "$env": OSM_CLIENT_ID
    client_secret:
      "$env": OSM_CLIENT_SECRET

In development, you can run Datasette and pass in environment variables like this:

OSM_CLIENT_ID="...client-id-goes-here..." \
OSM_CLIENT_SECRET="...secret-goes-here..." \
datasette -m metadata.yml

If you are deploying using datasette publish you can pass these using --plugin-secret. For example, to deploy using Cloud Run you might run the following:

datasette publish cloudrun mydatabase.db \
--install datasette-auth-osm \
--plugin-secret datasette-auth-osm client_id "your-client-id" \
--plugin-secret datasette-auth-osm client_secret "your-client-secret" \
--service datasette-auth-osm-demo

Once your Datasette instance is deployed, you will need to add its callback URL to the "Allowed Callback URLs" list your OAuth2 application in OpenStreetMap.

The callback URL should be something like:

https://url-to-your-datasette/-/osm-callback

Development

To set up this plugin locally, first checkout the code. Then create a new virtual environment:

cd datasette-auth-osm
python3 -m venv venv
source venv/bin/activate

Now install the dependencies and test dependencies:

pip install -e '.[test]'

To run the tests:

pytest

Metadata

Release files for datasette-auth-osm 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for datasette-auth-osm 0.2
File Size Uploaded
datasette-auth-osm-0.2.tar.gz 8.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for datasette-auth-osm 0.2
File Interpreter ABI Platform
datasette_auth_osm-0.2-py3-none-any.whl Python 3 none any Details

Total release size: 16.8 kB

Release files / datasette-auth-osm-0.2.tar.gz

Download URL datasette-auth-osm-0.2.tar.gz
Size 8.6 kB
Tags Source
SHA-256 checksum
How to use checksums
48c9cc33284f5b76d211345d61b67294f709f6507e0bb0be2f1be4e7c004991a
BLAKE2b-256 checksum
How to use checksums
c306c73c81ee583e2759dd63e89fc22554e72f201eecbed5da340e8e20bae2c8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release files / datasette_auth_osm-0.2-py3-none-any.whl

Download URL datasette_auth_osm-0.2-py3-none-any.whl
Size 8.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01ff0055bfb584306e02ec03af0018bd7b90f966b9a86df7652b662167a3b1d9
BLAKE2b-256 checksum
How to use checksums
79d844ec0db9554f900d823d46fbf6f6c9f16b73509f866e706b457b56556d09
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.10

Release history Release notifications | RSS feed

This release

0.2 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page