Products · Identity V1

Login using AWS

Sign up, sign in and password reset with AWS Cognito, integrated through standard OIDC.

Version 1 · Login with AWS CognitoDesigned, not builtModule 1 of 15

ProductRequirement EPICSections

Requirement EPIC

Epic
MVP1 · E1 · Accounts with AWS Cognito
Goal
users can create and manage an account securely, through OIDC so the provider can be swapped in MVP2.
Stories in this module
7

IDENTITY-V1-E1-01 Cognito user pool setup

  • AC1The user pool uses email as the username, requires a verified email and has a password policy of at least 12 characters with a mix of character types.
  • AC2Managed login is enabled and branded with the 01scale name, using an app client with the authorization code flow + PKCE and callback/logout URLs for production and localhost.
  • AC3The configuration is documented in docs/infra/cognito.md, with screenshots or CLI commands, so it can be rebuilt.

IDENTITY-V1-E1-02 Sign up with email verification

As a new user, I want to sign up with my email and password so I can use DocFlow.

  • AC1Given I'm signed out, when I choose "Sign up", then I'm taken to Cognito managed login's sign-up screen.
  • AC2Given I submit a valid email and password, when Cognito sends a verification code and I enter it, then I land on /documents signed in.
  • AC3Given I haven't verified my email, then I can't reach any protected page.
  • AC4On the first sign-in, a users row is created with cognito_sub and email, and auth.signup is audited.

IDENTITY-V1-E1-03 Sign in and sign out

  • AC1Sign-in uses the OIDC authorization code flow with PKCE and state/nonce checks via openid-client; a mismatch is rejected.
  • AC2After sign-in, the app creates its own session cookie (HttpOnly, Secure, SameSite=Lax). Cognito tokens stay on the server and never reach browser JavaScript.
  • AC3Sign-out clears the app session and calls Cognito's logout endpoint, so the next sign-in shows the login form.
  • AC4auth.signin and auth.signout are audited.
  • AC5A registered service or app can sign in as itself with a client secret, and a service allowed to act for users can exchange its token for a 5-minute token for one user, carrying act (decision on #24, docs/services/shared/v1/DECISIONS.md). Delegated tokens never carry Identity scopes.

IDENTITY-V1-E1-04 Forgot and reset password

  • AC1Given I choose "Forgot password", when I enter my email, then Cognito sends a reset code. The page says the same thing whether or not the account exists.
  • AC2Given a valid code and a new password that meets the policy, then I can sign in with the new password, and my old app sessions are invalidated.

GATEWAY-V1-E1-06 Route protection

  • AC1Middleware redirects signed-out users from /documents, /review, /pay, /success and /account to sign-in, and returns them to the page they asked for afterwards.
  • AC2The gateway returns 401 without a valid session or API key. Each service verifies the access token itself and returns 404 (not 403) for other users' resources, so IDs can't be probed.

IDENTITY-V1-E1-07 Branded sign-in page and address

Not needed for the first working login; build after IDENTITY-V1-E1-03.

As a visitor, I want the sign-in page to look like 01scale and live on a 01scale address, so I trust it with my password.

  • AC1The Cognito managed login pages show the 01scale name, logo and brand blue #0b00bf, in light and dark mode, on phone and desktop.
  • AC2The sign-in page is served from https://auth.01scale.com with a valid certificate (AWS Certificate Manager in us-east-1, plus the DNS records for 01scale.com). The amazoncognito.com address is no longer shown to users.
  • AC3Verification and password-reset emails come from a 01scale sender address through Amazon SES, with 01scale wording, and pass SPF and DKIM. The 50-emails-a-day limit of the default sender no longer applies.
  • AC4The change is configuration only: COGNITO_DOMAIN is updated and no Identity code or API contract changes. Sign-in, sign-out and password reset are re-tested end to end.
  • AC5docs/infra/cognito.md is updated with the steps so the setup can be rebuilt.

IDENTITY-V1-E1-08 Sign in with Google

Not in the first version of login; build after IDENTITY-V1-E1-03.

As a user, I want to sign in with my Google account so I don't need another password.

  • AC1The sign-in page shows "Continue with Google". Choosing it signs me in through Google and returns me to the page I asked for.
  • AC2Google is added as an identity provider on the Cognito user pool, using an OAuth client from a Google Cloud project with the scopes openid, email and profile. Google's client secret is stored only in AWS.
  • AC3One person is one user: when Google reports a verified email that matches an existing 01scale user, I am signed in to that same user and keep my documents. An unverified Google email is refused.
  • AC4A first-time Google user gets a new 01scale user without a separate email verification step, because Google has already verified the email.
  • AC5auth.signup and auth.signin audit events record provider: google.
  • AC6No other service or app changes: sessions, access tokens and GET /session are identical whichever way the user signed in.
  • AC7The Google Cloud and Cognito steps are added to docs/infra/cognito.md.