Skip to content

docs(bb-auth, auth-common): quick start, options and error tables for Auth; three corrected statements - #1638

Merged
xyos merged 9 commits into
aws:mainfrom
xyos:docs/readme-auth
Nov 19, 2026
Merged

xyos merged 9 commits into
aws:mainfrom
xyos:docs/readme-auth

Conversation

@xyos

@xyos xyos commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The Auth docs buried the first sign-in example and gave conflicting guidance about migrated sessions and session lifetime.

Changes

  • Start with the backend and browser setup, then separate recipes from option and error lookup tables.
  • Document that migrating from AuthCognito requires signing in again, the default session lifetime is 30 days, and AWS rememberDevice reports InvalidParameterException.
  • Clarify browser error matching, link the shared status reference, and document theming for all five auth UI components.

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.

@changeset-bot

changeset-bot Bot commented Nov 18, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5a00223

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@aws-blocks/bb-auth Patch
@aws-blocks/auth-common Patch
@aws-blocks/blocks Patch
@aws-blocks/create-blocks-app Patch

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

@pranavosu pranavosu left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.ts or from 'aws-blocks', including both Quick start snippets. Line 741 says the baseline file goes to aws-blocks/baselines/; main says cdk-blocks/baselines/.
  • packages/auth-common/README.md: 9 places with from '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 ## Usage into ## Recipes.
  • Move ## Errors next 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 ## Usage list, 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.
  • ## validateUser is 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 AuthUser and AuthAction.label entries). Write "for example".

Checked against the source

  • 30-day ttlSeconds default: packages/bb-auth/src/sessions.ts:59.
  • AuthCognito sessions not carried over: packages/bb-auth/src/session-store-id.ts (new child id session-store).
  • Status table and retriable list: match statusForAuthError and isRetriableAuthError in packages/bb-auth/src/errors.ts.
  • rememberDevice on AWS: 501 with name InvalidParameterException, packages/bb-auth/src/engines/native-cognito.ts:239.
  • mfa.types default ['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.

Comment thread packages/bb-auth/README.md Resolved
Comment thread packages/bb-auth/README.md Resolved
Comment thread packages/bb-auth/README.md Resolved
Comment thread packages/bb-auth/README.md Resolved
Comment thread packages/bb-auth/README.md Resolved
Comment thread packages/bb-auth/README.md Resolved
Comment thread packages/bb-auth/README.md Resolved
Comment thread packages/bb-auth/README.md Resolved
Comment thread packages/bb-auth/README.md Resolved
Comment thread packages/auth-common/README.md Resolved
xyos added 9 commits November 19, 2026 22:26
…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`.
@xyos
xyos merged commit 6ae587a into aws:main Nov 19, 2026
40 of 45 checks passed
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.

2 participants