demo: rename auth route to /api/auth/token and fix stale JSDoc#158
Draft
umair-ably wants to merge 1 commit into
Draft
demo: rename auth route to /api/auth/token and fix stale JSDoc#158umair-ably wants to merge 1 commit into
umair-ably wants to merge 1 commit into
Conversation
Align both demos (use-chat, use-client-session) with the AI Transport docs convention agreed in the auth consistency plan: - Rename `src/app/api/auth/ably-token/` -> `src/app/api/auth/token/`. The endpoint returns a JWT, not Ably's native Token type; a path containing `ably-token` reads as the wrong token type and is the exact JWT-vs-Token confusion the convention is meant to eliminate. - Update the client fetch in `providers.tsx` to match the new path. - Fix the stale JSDoc in `route.ts`: the comment said the client connects with `authUrl`, but the code uses `authCallback`. Reword to match the code. - Repoint the JSDoc `See:` link from the (now-redirected) URL `sessions-identity/identifying-users-and-agents` to the canonical AI Transport authentication page at `concepts/authentication`. Also updates README.md and docs/get-started/vercel-use-chat.md to use the new path so the documented setup matches the demo code. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Coverage Report
File CoverageNo changed files found. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Demo-side of the AI Transport auth consistency work. Companion to the docs PR at ably/docs#3397.
The endpoint returns a JWT, but its path read as Ably's native Token type. That's the exact JWT-vs-Token confusion the docs convention is now killing. This PR brings both demos onto the agreed neutral path.
What changed
src/app/api/auth/ably-token/→src/app/api/auth/token/in both demos (use-chat,use-client-session). Done withgit mvso history follows.providers.tsx(both demos) to match the new path.route.ts: the comment claimed the client connects withauthUrl, but the code usesauthCallback. Reworded to match the code.See:link repointed from the now-redirectedsessions-identity/identifying-users-and-agentsURL to the canonicalconcepts/authenticationpage.docs/get-started/vercel-use-chat.md) updated to use the new path, so the documented setup matches the running demo code.Why
/api/auth/tokenType-neutral on purpose. The endpoint returns a JWT — a path containing
ably-tokenreads as the native Ably Token type and was actively misleading./api/auth/tokencarries no token-type bias.Out of scope
clientIdshould be derived from an authenticated session rather than trusted from the request). The demos remain demo-simple by intent. The docs PR carries the security framing for production callers.Test plan
pnpm dev) and the chat flow round-trips successfully against the new routegrep -rn "ably-token\|sessions-identity"across the repo returns no hitspnpm run format:check🤖 Generated with Claude Code