{"id":15432889,"url":"https://github.com/simonw/datasette-auth0","last_synced_at":"2025-04-19T17:46:22.774Z","repository":{"id":62566787,"uuid":"474468776","full_name":"simonw/datasette-auth0","owner":"simonw","description":"Datasette plugin that authenticates users using Auth0","archived":false,"fork":false,"pushed_at":"2022-03-28T03:04:52.000Z","size":21,"stargazers_count":5,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-18T07:53:11.245Z","etag":null,"topics":["auth0","datasette","datasette-plugin"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/simonw.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-26T21:19:31.000Z","updated_at":"2023-04-05T04:53:07.000Z","dependencies_parsed_at":"2022-11-03T16:15:40.225Z","dependency_job_id":null,"html_url":"https://github.com/simonw/datasette-auth0","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdatasette-auth0","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdatasette-auth0/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdatasette-auth0/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/simonw%2Fdatasette-auth0/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/simonw","download_url":"https://codeload.github.com/simonw/datasette-auth0/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249752130,"owners_count":21320444,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["auth0","datasette","datasette-plugin"],"created_at":"2024-10-01T18:29:00.246Z","updated_at":"2025-04-19T17:46:22.748Z","avatar_url":"https://github.com/simonw.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# datasette-auth0\n\n[![PyPI](https://img.shields.io/pypi/v/datasette-auth0.svg)](https://pypi.org/project/datasette-auth0/)\n[![Changelog](https://img.shields.io/github/v/release/simonw/datasette-auth0?include_prereleases\u0026label=changelog)](https://github.com/simonw/datasette-auth0/releases)\n[![Tests](https://github.com/simonw/datasette-auth0/workflows/Test/badge.svg)](https://github.com/simonw/datasette-auth0/actions?query=workflow%3ATest)\n[![License](https://img.shields.io/badge/license-Apache%202.0-blue.svg)](https://github.com/simonw/datasette-auth0/blob/main/LICENSE)\n\nDatasette plugin that authenticates users using [Auth0](https://auth0.com/)\n\nSee [Simplest possible OAuth authentication with Auth0](https://til.simonwillison.net/auth0/oauth-with-auth0) for more about how this plugin works.\n\n## Installation\n\nInstall this plugin in the same environment as Datasette.\n\n    $ datasette install datasette-auth0\n\n## Demo\n\nYou can try this out at [datasette-auth0-demo.datasette.io](https://datasette-auth0-demo.datasette.io/) - click on the top right menu icon and select \"Sign in with Auth0\".\n\n## Initial configuration\n\nFirst, create a new application in Auth0. You will need the domain, client ID and client secret for that application.\n\nThe domain should be something like `mysite.us.auth0.com`.\n\nAdd `http://127.0.0.1:8001/-/auth0-callback` to the list of Allowed Callback URLs.\n\nThen configure these plugin secrets using `metadata.yml`:\n\n```yaml\nplugins:\n  datasette-auth0:\n    domain:\n      \"$env\": AUTH0_DOMAIN\n    client_id:\n      \"$env\": AUTH0_CLIENT_ID\n    client_secret:\n      \"$env\": AUTH0_CLIENT_SECRET\n```\nOnly the `client_secret` needs to be kept secret, but for consistency I recommend using the `$env` mechanism for all three.\n\nIn development, you can run Datasette and pass in environment variables like this:\n```\nAUTH0_DOMAIN=\"your-domain.us.auth0.com\" \\\nAUTH0_CLIENT_ID=\"...client-id-goes-here...\" \\\nAUTH0_CLIENT_SECRET=\"...secret-goes-here...\" \\\ndatasette -m metadata.yml\n```\n\nIf 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:\n```\ndatasette publish cloudrun mydatabase.db \\\n--install datasette-auth0 \\\n--plugin-secret datasette-auth0 domain \"your-domain.us.auth0.com\" \\\n--plugin-secret datasette-auth0 client_id \"your-client-id\" \\\n--plugin-secret datasette-auth0 client_secret \"your-client-secret\" \\\n--service datasette-auth0-demo\n```\nOnce your Datasette instance is deployed, you will need to add its callback URL to the \"Allowed Callback URLs\" list in Auth0.\n\nThe callback URL should be something like:\n\n    https://url-to-your-datasette/-/auth0-callback\n\n## Usage\n\nOnce installed, a \"Sign in with Auth0\" menu item will appear in the Datasette main menu.\n\nYou can sign in and then visit the `/-/actor` page to see full details of the `auth0` profile that has been authenticated.\n\nYou can then use [Datasette permissions](https://docs.datasette.io/en/stable/authentication.html#configuring-permissions-in-metadata-json) to grant or deny access to different parts of Datasette based on the authenticated user.\n\n## Development\n\nTo set up this plugin locally, first checkout the code. Then create a new virtual environment:\n\n    cd datasette-auth0\n    python3 -mvenv venv\n    source venv/bin/activate\n\nNow install the dependencies and test dependencies:\n\n    pip install -e '.[test]'\n\nTo run the tests:\n\n    pytest\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fdatasette-auth0","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsimonw%2Fdatasette-auth0","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsimonw%2Fdatasette-auth0/lists"}