Skip to content

Routes run authenticated, and the doc says how to read the caller - #300

Merged
czpython merged 1 commit into
mainfrom
authenticated-routes
Aug 22, 2026
Merged

Routes run authenticated, and the doc says how to read the caller#300
czpython merged 1 commit into
mainfrom
authenticated-routes

Conversation

@czpython

Copy link
Copy Markdown
Owner

Every extension router mounts behind the loader's identity gate — a Bearer PAT or the signed-in session — but writing-an-extension.md never said so, and its own OAuth example passes an account_id the author has no documented way to obtain.

druks.accounts now exports current_account_id, so the read comes from a concern namespace instead of the internal druks.accounts.context:

from druks.accounts import current_account_id

@router.get("/reviews")
def list_reviews() -> list[ReviewResponse]:
    return Review.list_for_account(current_account_id.get())

The routes section states the gate and shows the read; the OAuth section names the caller's three doors — self.account_id in a run body, current_account_id.get() in a route, the handler's argument in a subscriber — and the stable-imports table carries the new namespace.

@czpython
czpython enabled auto-merge (squash) August 22, 2026 06:25
@czpython
czpython disabled auto-merge August 22, 2026 06:25
Every extension router mounts behind the loader's identity gate — a
Bearer PAT or the signed-in session — but writing-an-extension.md never
said so, and its own OAuth example passes an account_id the author has
no documented way to obtain.

druks.accounts now exports current_account_id, so the read comes from a
concern namespace instead of an internal module. The routes section
states the gate and shows the read; the OAuth section names the caller's
three doors — self.account_id in a run body, current_account_id.get() in
a route, the handler's argument in a subscriber — and the stable-imports
table carries the new namespace.
@czpython
czpython force-pushed the authenticated-routes branch from a67a5d4 to f89f4ec Compare August 22, 2026 08:51
@czpython
czpython enabled auto-merge (squash) August 22, 2026 08:51
@czpython
czpython merged commit f1f1e70 into main Aug 22, 2026
1 check passed
@czpython
czpython deleted the authenticated-routes branch August 22, 2026 08:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant