Repository navigation
docs(bb-auth, auth-common): quick start, options and error tables for Auth; three corrected statements - #1638
Conversation
🦋 Changeset detectedLatest commit: 5a00223 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
5a00223 to
e8c1a60
Compare
06d2136 to
2996391
Compare
pranavosu
left a comment
There was a problem hiding this comment.
Requesting changes for one blocking item. Everything else is wording and placement. The factual corrections check out against the source (listed at the end).
Blocking
1. The branch predates #1630, so it reverts the cdk-blocks rename. The merge base is f13a11ca, and GitHub reports the PR as conflicting. The new text still uses the old backend folder name:
packages/bb-auth/README.md: 23 places with// aws-blocks/index.tsorfrom 'aws-blocks', including both Quick start snippets. Line 741 says the baseline file goes toaws-blocks/baselines/;mainsayscdk-blocks/baselines/.packages/auth-common/README.md: 9 places withfrom 'aws-blocks'.
Rebase, change every snippet to cdk-blocks, and rerun the validation list. The SHAs in the Validation section are out of date after the rebase.
Suggestions
2. Section order mixes modes. The new order is Quick start, then Usage and Options (reference), then the stub IdP (a how-to), then Errors (reference), then Which option and why (explanation), then Recipes. Two moves would fix it:
- Move
### The stub IdP (stubIdp())from## Usageinto## Recipes. - Move
## Errorsnext to## Mode gates, which already has error tables.
A reader then goes from Quick start to the decision guide to Recipes, and the lookup sections follow.
3. Browser error matching differs between the two READMEs. bb-auth ## Errors says to use isBlocksError(e, 'NotAuthenticatedException') from @aws-blocks/blocks/client in the browser. The new auth-common example catches on the client with isAuthError from @aws-blocks/auth-common. If both work, say so in each README. If not, pick one for application code.
4. The changeset is long for a public changelog. It has 33 lines, including the "Moved within the file" and "Removed" lists. A changelog reader needs the three corrections and the new tables. Keep the reorganization details in the PR body.
5. The PR body is longer than a one-minute brief. Link the lines, words and "prose lines over 400 characters" table and the 20-item validation list instead of pasting them. Most of the file:line citations under Changes would work better as review comments. The Problem section, "Look hardest at" and Open questions are good as they are.
Nits
- 16 added lines use an em dash as a connector: the
## Usagelist, the stub IdP intro, the—default cells in Options, the sign-in-methods table and// src/index.ts — the SPA entrypoint. Use a colon or a period. ## validateUseris a bare symbol. A heading that says what the section does, such as## Reject sign-ups and sign-ins with validateUser, reads better. The PR's open question on headings already covers this.- The auth-common headings this PR moved are still in title case:
Server-Side Interface,Authenticator Component,Types Reference,Auth State Store (React). The Theming paragraphs after the first are still hard-wrapped. - Added lines use "e.g." (the
AuthUserandAuthAction.labelentries). Write "for example".
Checked against the source
- 30-day
ttlSecondsdefault:packages/bb-auth/src/sessions.ts:59. AuthCognitosessions not carried over:packages/bb-auth/src/session-store-id.ts(new child idsession-store).- Status table and retriable list: match
statusForAuthErrorandisRetriableAuthErrorinpackages/bb-auth/src/errors.ts. rememberDeviceon AWS: 501 with nameInvalidParameterException,packages/bb-auth/src/engines/native-cognito.ts:239.mfa.typesdefault['SMS', 'TOTP']:packages/bb-auth/src/auth-base.ts:2415.- All five components call
injectTheme():packages/auth-common/src/ui.ts:939, 1133, 1847, 2053, 2225.
2996391 to
f3b6cf8
Compare
…sions are not accepted The README said existing `AuthCognito` sessions are accepted. They are not: `Auth` reads a new session store and every user signs in once (`packages/bb-auth/src/session-store-id.ts`), so the statement is removed. The `session` table gave the `ttlSeconds` default as "30 days (was 400 days)"; it now reads "30 days" and gains rows for `freshAgeSeconds` and `crossDomain`. The README now opens with `## Quick start` (the backend file and the frontend mount), followed by `## Usage` with an `### Options` table of every top-level option and the nested options that had no table, taken from `AuthOptions` in `packages/bb-auth/src/types.ts`. A new `## Errors` section gives the default HTTP status of each error name, the three statuses that differ, the retriable names and where each matcher is imported from; `## Local development` starts with a table of local versus AWS behaviour; `## Mode gates` has a table of the server-side errors of a gated call. `## What it does` is replaced by `## Sign-out and password reset`, `## Bearer tokens (allowBearerAuth)` and `## Changes the block refuses`, and long paragraphs are lists with one fact per item. `## Recipes`, `### The first admin`, the two-block snippets and the `users` command lines that tests in `packages/bb-auth` read are kept.
…h an app uses The Theming section named three components that inject the stylesheet; all five do (`packages/auth-common/src/ui.ts`), so it now says "each component". `## Auth error names (AuthErrors)` lists all 44 names with their constant and meaning, from `packages/auth-common/src/errors.ts`. `## Exports` says that application code imports the UI from `@aws-blocks/blocks/ui`, before the examples. `## Custom auth UI: submitAuthAction` says that `setAuthState` and `submitAuthAction` are fully typed, so a custom form needs no `as any`; `## Types Reference` moves above it. `## Session-cookie security policy (/cookies)` moves to the end as a function table plus a list, and descriptions of how the components and the auth-state store work underneath are removed.
…ll needs no cast
`MIGRATION.md` said the default session lifetime is 400 days in `Auth`. It is 30 days (`DEFAULT_SESSION_TTL_SECONDS` in `packages/bb-auth/src/sessions.ts`), and the line now says so.
`CUSTOMIZING-AUTH-UI.md` gains one paragraph under the `AuthActionInput` contract: `submitAuthAction(authApi, { action: 'signOut' })` type-checks as written, so a hand-written call needs no `as any`.
3a0892e to
07a82ed
Compare
Problem
The Auth docs buried the first sign-in example and gave conflicting guidance about migrated sessions and session lifetime.
Changes
Validation
Node 22 build passed. Auth recipes, shipped-docs checks, catalog/import checks, and changeset guards were exercised on the rebased branch. The new stub IdP recipe was compiled after adding its standalone backend file. The scaffolder suite passed 403/404; its AGENTS.md docs-command bullet assertion failed outside this diff. See PR checks for CI.