Skip to content

Commit 1289422

Browse files
xrendanclaude
andcommitted
Add id field to actor object for consistency with Datasette actor format
This change adds an "id" field to the actor object returned by the GitHub authentication callback. The id field follows the format "github:{user_id}" which is consistent with Datasette's actor format conventions and ensures unique identification of authenticated users. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 83add2b commit 1289422

2 files changed

Lines changed: 2 additions & 0 deletions

File tree

‎datasette_auth_github/views.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ async def github_auth_callback(datasette, request, scope, receive, send):
7676
except ValueError:
7777
return await response_error(datasette, "Could not load GitHub profile")
7878
actor = {
79+
"id": "github:{}".format(profile["id"]),
7980
"display": profile["login"],
8081
"gh_id": str(profile["id"]),
8182
"gh_name": profile["name"],

‎tests/test_datasette_auth_github.py‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,7 @@ async def test_github_auth_callback(ds, mocked_github_api):
154154
)
155155
actor = ds.unsign(response.cookies["ds_actor"], "actor")["a"]
156156
assert {
157+
"id": "github:123",
157158
"display": "demouser",
158159
"gh_id": "123",
159160
"gh_name": "GitHub User",

0 commit comments

Comments
 (0)