Skip to content
1 change: 1 addition & 0 deletions docs/content/docs/(guides)/concepts/jwt.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ Stack Auth JWTs contain standardized headers and claims that power authenticatio
- **`project_id`**: Your Stack Auth project ID
- **`branch_id`**: The project branch (currently always `main`)
- **`refresh_token_id`**: ID of the associated refresh token
- **`requires_totp_mfa`**: Whether the user has TOTP multi-factor authentication enabled
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Citation: Based on commit c8b5168 "Add requires_totp_mfa to JWT". The commit added requires_totp_mfa to tokens.tsx, schema-fields.ts, and the example JWT in jwt.mdx, but didn't add a description in the Stack Auth Specific Claims section. The field indicates whether the user has TOTP MFA enabled, as shown in the e2e tests in access-token-refresh.test.ts.
View source

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 Description diverges from internal OpenAPI spec

The added description says "Whether the user has TOTP multi-factor authentication enabled," but the internal OpenAPI spec in packages/stack-shared/src/interface/crud/users.ts describes this field as "Whether the user is required to use TOTP MFA to sign in". These are subtly different: a user could have TOTP configured without it being required at sign-in, or an admin could enforce MFA on users who already have TOTP set up. The claim name itself (requires_totp_mfa) and its SDK mapping to isMultiFactorRequired both reinforce the "required to use" semantics rather than simply "has enabled."

Consider aligning the docs with the existing internal description:

Suggested change
- **`requires_totp_mfa`**: Whether the user has TOTP multi-factor authentication enabled
- **`requires_totp_mfa`**: Whether the user is required to use TOTP MFA to sign in

- **`role`**: Always set to `authenticated` for valid users
- **`name`**: The user's display name (nullable)
- **`email`**: The user's primary email address (nullable)
Expand Down
Loading