Summary: Since the 2026-09-14 migration, 7Mind users authenticate against Gymondo’s SSO service on AWS Cognito, tokens are validated and rotated by Kong, and the account id is the numeric Gymondo id instead of the old 7Mind UUID.
Sources: Gymondo-git/function-sevenmind-legacy-gateway (README, docs/superpowers/specs), Gymondo-git/function-sso (docs/password-reset.md, PRs #103, #114, #116, #124), Gymondo-git/terraform workspace apps; sevenmind/website-next-js (lib/auth/tokens.ts); sevenmind/7mind-mobile-apps-monorepo (lib/features/core/domain/auth/, lib/features/authentication/network/sso_api_client.dart); Notion “7Mind Authentication & Registration” (May 2026), “Migration Bug Status, Summary for CTO (23 Sep 2026)”; Slack 7m_product-team-public; on 2026-11-09 the app’s lib/app/routes/magic_login_link.dart, lib/features/core/network/upgrade_token_client.dart (origin/main, 4.0.9) and the gateway’s internal/routes/routes.go
Last updated: 2026-11-09
The pieces
- Amazon Cognito user pool: the identity store for all 7NXT brands.
function-sso(Gymondo-git): Go Lambdas for the password grant, sign-up, social sign-in (Apple, Google, Facebook), magic link, device code, password reset and reset confirmation, plus Cognito triggers (custom message, user migration, pre-signup). DynamoDB holds SSO user info. 7Mind-specific config (Sign in with Apple audiencesde.7mind.iphone,.ios,.www, magic-link vendor config,ALLOWED_ORIGINS_SEVENMIND) lives in Gymondo-git/terraformworkspaces/apps.- Kong: on protected routes it validates
x-access-token, rotates tokens usingx-refresh-tokenand returns new tokens in the response headers, and injects the verified identity asx-userinfo. Services behind Kong trust that header. - function-sevenmind-legacy-gateway: translates the old 7Mind auth calls (
/user_identity/signin,/signup,/signinup,/user/password/reset/send,/user/signout,/user_identity/user/me) intofunction-ssocalls on the private Kong routes.
How each client signs in
Mobile app (7mind-mobile-apps-monorepo): calls the legacy routes on magic.7mind.de, which the gateway fulfils. Token headers are x-access-token, x-id-token and x-refresh-token (lib/features/core/domain/auth/token/auth_token_keys.dart). Password reset is the one flow that goes to the SSO API directly: POST https://app.7mind.de/api/v2/users/reset-password with an allow-listed Origin header (MIND-830). The legacy reset route on magic.* collapses SSO errors, so new auth work should call the SSO API directly. Two more entry points exist. A magic login link (MIND-815, app 3.3.28 and later), sevenmind://login with access_token, id_token and refresh_token in the query or fragment, signs the user in with tokens issued elsewhere, for one-tap login buttons in CRM emails (see mobile-deep-linking). POST /user_identity/upgradeauth (UpgradeDachToken, ACC-57) is still called from the splash screen of production builds when a token of the pre-Flutter native app is found; Kong routes it, but the gateway deliberately does not implement it and answers 404, so such a user has to log in again.
Website (website-next-js): login and signup happen on frontend-public-pages at app.7mind.de. The OAuth tokens it issues are shared with the marketing site through parent-domain cookies (oauth2AccessToken, oauth2IdToken, oauth2RefreshToken). The website copies them into request headers for calls to magic.7mind.* and writes rotated tokens back from the response headers (lib/auth/tokens.ts). Cookie names and encoding must match frontend-core exactly; a mismatch silently splits the session.
The user id switch
- Every migrated account got a numeric Gymondo id (example shape:
10371329). Theuuidfield in the profile response now carries that numeric id.idis the canonical field (MIND-829);legacyUuidcarries the retired 7Mind UUID,nullfor accounts created after the migration. - The gateway answers
GET /user_identity/user/me/legacy_identityfrom an index of 3,200,320 UUID-to-id rows embedded in its binary. - Anything keyed by user id broke at the switch and had to be migrated: app local storage (MIND-828), Braze and other analytics identities, practice events sent under the old UUID (MIND-863), and the Aury companion consent. When you add a new per-user key or integration, assume both ids exist in the wild.
Migration behaviour worth knowing
- All tokens were revoked at cutover (2026-09-14). Every user had to log in again.
- Passwords migrate lazily: a Cognito user migration trigger checks the legacy credential on first login. A user therefore has no Cognito record until they log in once on the new platform.
- Double accounts: about 18k people had a Gymondo social login and a 7Mind password login with the same email. The import first kept only the Gymondo method; the password method was restored afterwards.
- Rate limiting: the gateway originally called the public
function-ssoroutes, whose IP-keyed limiter treated all 7Mind users as one client and refused 12,807 requests on cutover day. It now uses the private routes. - Never answer 401 or 403 to the old app: installed builds delete their session on either. The gateway maps refusals to 404 or 409 instead.
Error contract
SSO responses use code, message (sso.<lowercased code>) and debugMessage. Branch only on the first two. Known codes include UserNotFoundException, RegisteredViaSocialLogin (provider in message), LimitExceededException (403 after repeated reset requests, clears itself) and InternalErrorException. 7Mind deliberately shows neutral copy for unknown users on password reset.
Before the migration
7Mind’s old auth was native to the Elixir backend (phx.gen.auth plus Assent for social login, a signed backend_session cookie, sessions in Postgres). SuperTokens only served 7Sleep and the identity service on id.7mind.de. See supertokens-auth for that legacy setup.
Related
- platform-unification — the migration that introduced this setup
- gymondo-platform — where Kong and Cognito sit in the platform
- function-sevenmind-legacy-gateway — translates the old auth routes
- frontend-public-pages — the web login and signup UI
- supertokens-auth — the legacy auth setup