diff --git a/README.md b/README.md index a95a299..2c4643d 100644 --- a/README.md +++ b/README.md @@ -64,6 +64,7 @@ Visit `/-/actor` when signed in to see the shape of the authenticated actor. It ```json { "actor": { + "id": "github:9599", "display": "simonw", "gh_id": "9599", "gh_name": "Simon Willison", @@ -106,7 +107,7 @@ Note that GitHub allows users to change their username, and it is possible for o ```json { "allow": { - "gh_id": "9599" + "id": "github:9599" } } ``` diff --git a/datasette_auth_github/views.py b/datasette_auth_github/views.py index 1758e5b..db9ecf5 100644 --- a/datasette_auth_github/views.py +++ b/datasette_auth_github/views.py @@ -76,6 +76,7 @@ async def github_auth_callback(datasette, request, scope, receive, send): except ValueError: return await response_error(datasette, "Could not load GitHub profile") actor = { + "id": "github:{}".format(profile["id"]), "display": profile["login"], "gh_id": str(profile["id"]), "gh_name": profile["name"], diff --git a/tests/test_datasette_auth_github.py b/tests/test_datasette_auth_github.py index fb9d2af..019542c 100644 --- a/tests/test_datasette_auth_github.py +++ b/tests/test_datasette_auth_github.py @@ -154,6 +154,7 @@ async def test_github_auth_callback(ds, mocked_github_api): ) actor = ds.unsign(response.cookies["ds_actor"], "actor")["a"] assert { + "id": "github:123", "display": "demouser", "gh_id": "123", "gh_name": "GitHub User",