Skip to content

feat(app-ui): open an app page once from a one-time launch link - #2604

Open
zackleman wants to merge 4 commits into
UsefulSoftwareCo:v2from
zackleman:feat/app-ui-launch-links
Open

zackleman wants to merge 4 commits into
UsefulSoftwareCo:v2from
zackleman:feat/app-ui-launch-links

Conversation

@zackleman

@zackleman zackleman commented Nov 26, 2026 •

Copy link
Copy Markdown

Adds appUi.launch: a one-time link that opens a private app page signed in, for a browser that has no Executor session, such as an embedded web view or a fresh browser profile. Today such a browser can only reach an app page through dashboard sign-in, which some sign-in providers refuse inside embedded web views.

What it does

  • POST /api/organizations/:organization/apps/:app/ui/launch (code mode: tools.executor.appUi.launch({ path: { organization, app } })) answers with the same union as appUi.location. In the ready case, url is https://<app origin>/_executor/auth/launch?code=<64 hex>.
  • Opening that URL as a top-level navigation consumes the code, sets the usual app session cookie (__Host-executor_app, HttpOnly, Secure, SameSite=Lax, Path=/) and redirects to /. A spent, expired, unknown or other app's code gets the existing "Could not sign in to this app" page and no cookie.
  • The link makes the checks opening the app makes (membership, the app's use access, a token's data action and app scope), works once, and expires after 60 seconds. Only the SHA-256 digest of the code is stored, in the Better Auth verification table the app sign-in records already use. Telemetry records paths only, so the code never reaches a span.

Who may launch

Only a caller holding a browser session or an API key. An OAuth access token gets 403: a grant's authority can narrow and its tokens lapse with no row a later app request could recheck. An API key with a use budget (remaining set) is never accepted as the page's parent. An MCP client connected through OAuth still gets a link through code mode, since the Executor app makes that call with its own API key.

Session lifetime

A launched session lasts at most one hour, not the week a dashboard sign-in gets, because the key behind it can outlive the agent that asked. It also ends sooner when its parent credential (the caller's dashboard session or API key) is revoked, disabled or expired, checked on every request. Dashboard sign-in sessions are unchanged, and existing session records still decode: a dashboard parent stays a bare session ID.

Links are not spent by accident

  • A HEAD, a prefetch (Sec-Purpose: prefetch or Purpose: prefetch, as link previews send) or a subresource or frame request (Sec-Fetch-Dest present and not document) gets 405 and leaves the code unspent. A client that sends no fetch metadata is let through.
  • A browser that already holds an app session that may still open this app keeps it: the link redirects to / without spending the code or replacing the cookie, so a link someone else sends cannot swap whose page the browser shows.

The link is a bearer credential for its 60 seconds: whoever opens it first is signed in as the caller. The tool description says to treat it as a password.

app-ui-launch.spec.ts
app-ui.spec.ts

Tests

app-ui-launch.spec.ts covers the link through an OAuth-connected MCP client, single use, other apps, 405 for HEAD, prefetch and Sec-Fetch-Dest: image without spending the link, an existing app session kept, a member without access and an OAuth token both refused, the 60 second expiry, a cookie expiry within (50, 60] minutes and a 401 after the clock moves 61 minutes, and the session ending when the API key is revoked.

Tested locally on self-host: app-ui-launch.spec.ts, app-ui.spec.ts, app-ui-failures.spec.ts and the private app access scenario in resource-access.spec.ts (15 passed). The main scenario is also scheduled on Cloud, which I could not run locally. bun run check passes.

🤖 Generated with Claude Code

Add appUi.launch, POST /api/organizations/:organization/apps/:app/ui/launch.
It answers as appUi.location does, and when the page is ready its URL is a
one-time link on the app's origin, /_executor/auth/launch?code=... Opening it
in a browser with no Executor session, such as an embedded web view, signs
that browser in to the one app and redirects to its root.

The link makes the same checks as opening the app (membership, the app's use
access, a token's data action and app scope), works once, expires after 60
seconds, and is kept only as the digest of its code in Better Auth's
verification store. Its session is the usual app-origin session (HttpOnly,
SameSite=Lax, __Host- and Secure on HTTPS, at most a week) and ends with the
credential that asked for it: a dashboard session as before, or an API key or
OAuth grant, checked on every use like a session's parent login.

Release-note: Feature: Executor can give a one-time link that opens an app's page signed in, for a browser with no Executor session such as an embedded web view.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
zackleman and others added 3 commits November 26, 2026 21:14
…t by previews

An OAuth grant's authority can narrow and its tokens lapse with no row an app
request could recheck, so a launch from one is refused rather than leaving a
page session that outlives or outgrows its grant. A HEAD or prefetch leaves the
code unspent, and a browser already signed in to the app keeps its session.

Release-note: Feature: Self-host can open a private app page in a browser with no Executor session through a one-time launch link from the appUi.launch operation.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…p logins

A browser's subresource or frame request leaves a launch link unspent, and a
browser counts as signed in to the app only while its session may still open
it. The launch scenario now asks for the link through an OAuth-connected MCP
client, as an agent does.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
An agent can launch through the Executor app's own key, which outlives the
agent's grant, so a launched page's session lasts an hour, not a signed-in
week. Dashboard sign-ins are unchanged.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

This branch has not been deployed

No deployments
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