Case study · independent demonstration

From a Help-Center Article to Docs-as-Code

One weak help-center article about a security task, audited, split into pages by purpose, migrated to MDX, versioned in Git, checked with Vale, published with Docusaurus, tested for translation, and revised. Every stage is a real commit, and every output is here to inspect.

  • 14 audit findings, 2 critical
  • 8 commits, one per stage
  • 7 → 0 Vale errors
  • 7 pages published, in English and a pseudo-locale

Open the published docsRead the source on GitHub

The article is original, made for this case study in the shape of a Zendesk Guide article. It isn’t an export from an employer. The product is Keycloak 26.8.2, running on my own computer with test users, so every claim can be checked. Not official Keycloak documentation, and not work done for any company. This independent portfolio demonstration was developed with AI assistance under my direction. Source files, validation results and known limitations are available for inspection.

1Source

The starting point: a short article as many help centers hold them, written once and never reviewed.

Help CenterLogin issues

How to reset 2FA

Title not in Title Case

Sometimes users lose their phone and can’t login anymore. This is a piece of cake to fix!

Steps:

1. Login to Keycloak and go to users.

2. Find the user and click on credentials tab.

3. Simply delete the OTP and the user will be asked to setup 2FA again on their next login.

Picture: no alternative text

You can change the MFA settings here if needed.

Note: codes are valid 30 secs.

If it still doesn’t work please contact IT.

Last updated 3/4/25

Format
Zendesk Guide API record (article.json)
Labels
mfa, keycloak, login issues
Locale
en-us
Owner
None
Reviewed
Never
Product version
Not stated

2Audit

14 findings: the quote, the problem, the fix. Two are critical, and neither is a matter of style.

  1. A1 Critical Accuracy

    Simply delete the OTP and the user will be asked to setup 2FA again on their next login.

    Problem. False in Keycloak 26.8.2. With the default browser flow, a user whose OTP credential was deleted signs in with the password alone, and nothing asks them to set up a new authenticator. The account is left with one factor. Evidence: evidence.json, step signin-without-required-action: otp_prompt false.

    Fix. The how-to adds the step that was missing: Configure OTP in Required user actions, then Save. A caution says why the step matters.

  2. A2 Critical Security

    Sometimes users lose their phone and can’t login anymore.

    Problem. Nothing asks the administrator to confirm that the request comes from the account’s owner. A reset on a request from someone else hands them the account.

    Fix. A shared Before you start section, reused by the how-to and the troubleshooting page, asks for confirmation through contact details given before the phone was lost.

The other 12 findings: terminology, structure, accessibility, localization, governance
  1. A3 Major Terminology

    2FA … OTP … MFA settings

    Problem. Three names for one thing, none of them defined. Keycloak’s console calls it OTP: the credential type is Otp and the required action is Configure OTP. A translator, a search engine and a reader each see three subjects.

    Fix. One term, one-time password (OTP), defined once on the concept page and recorded in the terminology list for translation.

  2. A4 Major Accuracy

    go to users … click on credentials tab

    Problem. The labels don’t match the interface (Users, Credentials), and the steps skip the realm: an administrator of the master realm searches the wrong realm’s users.

    Fix. Interface labels in bold, exactly as the console shows them, and a first step that checks the current realm.

  3. A5 Major Structure

    <p><strong>Steps:</strong></p> <p>1. Login to Keycloak …

    Problem. Bold text in place of a heading, and step numbers typed into paragraphs. Screen readers and the help center’s own table of contents see no structure, and one task is mixed with background and settings.

    Fix. Real headings and an ordered list, and the content split by purpose: a concept, a how-to, a reference and a troubleshooting page.

  4. A6 Major Completeness

    (no check that the reset worked)

    Problem. The reader can’t tell success from failure, and nothing records what was done.

    Fix. A Check that it worked section: the new Otp row, its date, and the admin events Keycloak keeps.

  5. A7 Major Troubleshooting

    If it still doesn’t work please contact IT.

    Problem. No symptom, no cause, no action, and the reader is often IT.

    Fix. A troubleshooting page organised by what the user sees, each with its cause and the fix, reproduced on the server.

  6. A8 Major Accessibility

    <img src="/hc/article_attachments/900000000201">

    Problem. No alternative text and no caption. A reader who can’t see the picture loses its content, and nobody can tell which step it belongs to.

    Fix. Each screenshot has alternative text that says what is marked, sits under the step it shows, and has its sensitive values hidden.

  7. A9 Minor Accessibility

    You can change the MFA settings <a …>here</a>

    Problem. "here" says nothing out of context, and screen-reader users often move from link to link.

    Fix. Link text that names the destination: Keycloak OTP policy.

  8. A10 Major Localization

    a piece of cake … secs … Last updated 3/4/25

    Problem. An idiom that doesn’t translate, an abbreviation, an exclamation, and a date that means 3 April in France and 4 March in the US.

    Fix. Plain wording, units in full, and dates kept by the publishing system in ISO 8601, so each locale can show its own format.

  9. A11 Minor Grammar

    can’t login … Login to Keycloak … setup 2FA

    Problem. Login and setup are nouns. The verbs are sign in and set up.

    Fix. Sign in and set up as verbs, everywhere, enforced by a Vale substitution rule.

  10. A12 Major Governance

    label_names: mfa, keycloak, login issues

    Problem. No owner, no reviewer, no review date, no product version and no audience. Nobody knows when the article stops being true, and it says nothing about the Keycloak version it describes.

    Fix. Front matter on every page: owner, audience, product version, last review and review interval. The Git history records every change and who approved it.

  11. A13 Minor Audience

    Sometimes users lose their phone

    Problem. It opens with the user’s problem, but every step is an administrator’s. A user who finds it can do none of it.

    Fix. The how-to says who it’s for in its first lines. The user’s side, setting up the new phone, is one step with its own screenshot.

  12. A14 Minor Tone

    Simply delete …

    Problem. Simply tells a reader who is stuck that the task is easy. Here it also hides the step that makes the reset safe.

    Fix. No minimisers; Vale flags simply, just and easily.

3Information Architecture

The article mixed a user’s problem, an administrator’s task, a setting and a dead end. Each becomes a page with one purpose, so a reader lands on what they came for and each page can be reviewed on its own.

From one article to a set of pagesThe help-center article How to reset 2FA becomes four kinds of page: a concept, a how-to, a reference and a troubleshooting page. The how-to and the troubleshooting page share one caution, Confirm who is asking. A Changes page records each revision. Help-center articleHow to reset 2FA ConceptOne-Time Passwords in KeycloakHow-toReset a User's OTP CredentialReferenceOTP Policy Settings · TerminologyTroubleshootingWhen a Code Doesn't Work Confirm who is asking Changes1.0 to 1.2, with the reasons One article, four purposes.The bracket on the right joinsthe two pages that share a caution.
The pages and what each holds
TypePageHoldsFrom findings
ConceptOne-Time Passwords in KeycloakWhat an OTP credential is, what a required action does, and why deleting a credential doesn’t by itself ask for a new one.A3, A13
How-toReset a User’s OTP CredentialThe administrator’s task, step by step, with screenshots and the check.A1, A2, A4, A5, A6, A8
ReferenceOTP Policy SettingsEvery setting of the realm’s OTP policy, its default in 26.8.2, and the matching REST field.the note on 30 seconds
TroubleshootingWhen a User Can’t Sign In with a One-Time PasswordThree symptoms, each with its cause and the fix.A7

4Migration to MDX

Each page is an MDX file: Markdown with components. The front matter carries what the audit found missing; a partial holds the identity check once for two pages; a Screenshot component gives every picture its alternative text, caption and size. One sentence per line, so a diff shows exactly which sentence changed.

site/docs/how-to/reset-otp.mdx, the first steps
---
title: Reset a User's OTP Credential
description: Delete a lost authenticator's OTP credential in Keycloak, and make the user set up a new one at their next sign-in.
doc_type: How-to
audience: Keycloak administrators
product_version: Keycloak 26.8.2
owner: Karan Deshmukh
last_review: 2026-11-28
---

import PageFacts from '@site/src/components/PageFacts';
import Screenshot from '@site/src/components/Screenshot';
import ConfirmIdentity from '../_partials/_confirm-identity.mdx';

# Reset a User's OTP Credential

<PageFacts />

When a user loses or replaces the phone that holds their authenticator app, sign the user out, delete the phone's one-time password (OTP) credential, and make the user set up a new one at their next sign-in.

This procedure resets the OTP credential only.
It doesn't remove passkeys, security keys or other second factors that the user may also have.

## Before You Start {#before-you-start}

<ConfirmIdentity />

- Sign in to the admin console with an account that can manage the users of the user's realm.
- Have the user's username or email address.
- Make sure that the user has the new phone, with an authenticator app such as FreeOTP, Google Authenticator, or Microsoft Authenticator.
- Check that the realm uses Keycloak's default browser flow, in which the OTP step is conditional.
  With a custom flow, Keycloak may ask for a code at a different point, or not at all.

## Steps {#steps}

:::important Do the steps in this order
1. Sign the user out first: an open session reaches **Mobile Authenticator Setup** without asking for the password.
2. Add the required action before you delete the credential: in the other order, the user can sign in with the password alone in between.

Both behaviors were tested on Keycloak 26.8.2.
:::

1. In the admin console, check that the user's realm is the current realm: its name is at the top of the menu.
   Select **Users**, search for the user, and then select their username.

   <Screenshot src="/img/keycloak/01-find-user.png" alt="The Users page of the admin console. The search box is outlined in green, and the username alex.morgan is outlined and marked 1." caption="Step 1. Search for the user, and then select their username." />

2. On the **Sessions** tab, select **Logout all sessions**, and then select **Confirm**.

   The dialog says that it signs out "active subjects in this realm."
   On a user's **Sessions** tab, it signs out that user only. In a test with a second user, the second user's session stayed open.

   <Screenshot src="/img/keycloak/00-sessions.png" alt="The Sessions tab of alex.morgan, marked 1, with one open session in the list. The Logout all sessions button is outlined and marked 2." caption="Step 2. Sign the user out of every open session." />

The whole file on GitHub · The shared partial · The Screenshot component

5Version Control

One commit per stage, each saying what changed and why. The diffs below are those commits' own.

  1. 4671528stage 1: the help-center article as it stands1 files, +19 −0
  2. e850cbdstage 2: audit the article1 files, +68 −0
  3. cb4f756stage 3: a Docusaurus project for the docs83 files, +23913 −0
  4. d0ed60astage 4: migrate the article to MDX19 files, +320 −1
  5. 1113093stage 5: lint with Vale and review the results14 files, +3056 −18
  6. 275bb3astage 6: pseudo-localize to test translation readiness15 files, +799 −0
  7. ec4b1f3stage 6: make the page labels translatable7 files, +65 −6
  8. 2e8cef9stage 7: revise the how-to with a tested REST API method22 files, +1379 −13

Stage 5: Lint Fixes

  1. site/.vale.ini
  2. # Vale checks every page before it’s published. The Google developer style, alex (inconsiderate wording) and
  3. # Readability are the open-source packages from errata-ai, pinned in styles/VERSIONS. Portfolio holds the house rules
  4. # that came out of the audit.
  5. # that came out of the audit. Every exception below is a decision, recorded in quality/decisions.md.
  6. StylesPath = styles
  7. MinAlertLevel = suggestion
  8. Vocab = Portfolio
  9. # Quoted, not written: interface labels in bold and Keycloak’s own messages in italics keep the product’s wording.
  10. IgnoredScopes = code, tt, strong, em
  11. [*.{md,mdx}]
  12. [*.{md,mdx,html}]
  13. BasedOnStyles = Vale, Google, alex, Readability, Portfolio
  14. # Front matter values and component props are data, not prose.
  15. TokenIgnores = (<[A-Z][A-Za-z]+[^>]*/>)
  16. # Keycloak’s names for its admin console, admin REST API and admin events keep their wording.
  17. TokenIgnores = ([Aa]dmin (?:console|REST API|events))
  18. # "period" is the OTP policy’s term for how long a code lasts. alex flags every use as possible profanity.
  19. alex.ProfanityUnlikely = NO
  20. site/docs/concepts/one-time-passwords.mdx
  21. In Keycloak 26.8.2, that step is the subflow **Browser - Conditional 2FA**, and
  22. So when an administrator deletes a user’s OTP credential, nothing asks for a code at the next sign-in, and nothing asks the user to set up a new authenticator.
  23. The user signs in with their password alone, until the **Configure OTP** required action is added.
  24. The user signs in with their password alone, until an administrator adds the **Configure OTP** required action.
  25. :::caution
  26. site/docs/index.mdx
  27. import PageFacts from '@site/src/components/PageFacts';
  28. These pages explain one administrator task in Keycloak from every side: resetting a user’s one-time password (OTP) when they lose their phone.
  29. They were migrated from a single help-center article, and split by what the reader needs.
  30. They come from a single help-center article, split by what the reader needs.
  31. | If you need to | Read |
  32. They were migrated from a single help-center article, and split by what the read
  33. | Understand what an OTP credential and a required action are | [One-time passwords in Keycloak](./concepts/one-time-passwords.mdx) |
  34. | Reset a user’s OTP after they lose their phone | [Reset a user’s one-time password](./how-to/reset-otp.mdx) |
  35. | Check the realm’s code length, period and other settings | [OTP policy settings](./reference/otp-policy.mdx) |
  36. | Check the realm’s code length, period, and other settings | [OTP policy settings](./reference/otp-policy.mdx) |
  37. | Help a user whose code doesn’t work | [When a user can’t sign in with a one-time password](./troubleshooting/otp-sign-in.mdx) |
  38. :::note Independent documentation
  39. Karan Deshmukh wrote these pages as a portfolio demonstration and checked every step on a Keycloak 26.8.2 server running on his own computer, with a test realm and test users.
  40. Karan Deshmukh wrote these pages as a portfolio demonstration and checked every step on a local Keycloak 26.8.2 server.
  41. The server held a test realm and test users only.
  42. They aren’t official Keycloak documentation.
  43. :::
  44. site/docs/troubleshooting/otp-sign-in.mdx
  45. With the default look around window of 1, Keycloak also accepts the code of the
  46. 1. Ask the user to type the code that the app shows now, before its timer runs out.
  47. 2. If every code fails, ask the user to set the phone’s date and time to update automatically.
  48. An authenticator computes each code from the time, so a phone that is a minute off produces codes Keycloak refuses.
  49. An authenticator computes each code from the time, so a phone that’s a minute off produces codes Keycloak refuses.
  50. 3. If many users' codes fail, check the server’s clock before you widen the look around window in the [OTP policy](../reference/otp-policy.mdx#settings).
  51. A wider window accepts older codes, for everyone.
  52. With the default look around window of 1, Keycloak also accepts the code of the
  53. <ConfirmIdentity />
  54. Delete the user’s OTP credential and make them set up a new one: [Reset a user’s one-time password](../how-to/reset-otp.mdx).
  55. Delete the user’s OTP credential and make them set up a new one, as [Reset a user’s one-time password](../how-to/reset-otp.mdx) describes.
  56. ## Keycloak doesn’t ask for a code {#no-code-asked}

6Editorial Review

The checklist I review a page against before it goes out. Nobody else reviewed these pages: this is self-review, done in the open, and each line says where to see the result.

  • Every factual claim checked against the product Against Keycloak 26.8.2's recorded behaviour (A1), and the REST steps run as written.
  • Audience and purpose stated at the top of each page Front matter: type, audience, version, owner, review date.
  • One action per step, in the order of the screens Six steps in the console; four in the REST method.
  • Interface labels exactly as shown Bold, with Keycloak’s capitals, including Otp.
  • A result the reader can check Check that it worked: the new Otp row and the admin events.
  • Risks before the step that causes them The identity check comes first; the caution sits under step 4.
  • Links that say where they go Vale rule Portfolio.LinkText.
  • Pictures with alternative text and a caption 12 of 12 screenshots.
  • Terms consistent with the terminology list Vale rules Portfolio.Terms and Portfolio.Verbs: 0 errors.
  • Nothing confidential in pictures or examples The QR code and the secret key are hidden; the realm and users are test data.

An AI-assisted Draft, Corrected

An AI-assisted draft, and the human review that corrected it. The draft was produced on 27 November 2026 by Claude (Anthropic), the AI assistant that helped build this portfolio, from the source article alone and the prompt below, with no access to the Keycloak server or its recorded evidence. The review then checked each claim against the server’s recorded behaviour, before anything was published.

The AI draft
# Reset two-factor authentication (2FA) for a user
If a user loses access to their authenticator app, an administrator can reset their 2FA.
1. Log in to the Keycloak Admin Console.
2. Go to **Users** and search for the user.
3. Open the **Credentials** tab.
4. Delete the OTP credential.
5. The user will be prompted to configure 2FA again the next time they log in.
Note: OTP codes are valid for 30 seconds.
  1. False Line 7

    The user will be prompted to configure 2FA again the next time they log in.

    Keycloak 26.8.2's recorded behaviour: after the deletion, the user signed in with the password alone (evidence.json, signin-without-required-action, otp_prompt false).

    Fix. Add the step that was missing: Configure OTP in Required user actions, then Save, with a caution that says why.

  2. Incomplete Line 3

    Log in to the Keycloak Admin Console.

    An administrator of the master realm lands in the master realm, not the user’s.

    Fix. Sign in, and check that the user’s realm is the current realm before searching.

  3. Missing a safeguard Line 2

    an administrator can reset their 2FA

    Nothing asks who is making the request. A reset for someone else hands them the account.

    Fix. Confirm the request through contact details the user gave before they lost the phone.

  4. True by default only Line 8

    OTP codes are valid for 30 seconds.

    30 seconds is the default period of a new realm’s OTP policy; a realm can change it, and the default look around window also accepts the previous and next code.

    Fix. Moved to the OTP policy reference, as a default, with the look around window.

  5. Terminology Line 1

    Reset two-factor authentication (2FA)

    Keycloak’s console calls it OTP: the credential type is Otp and the required action is Configure OTP.

    Fix. One-time password (OTP), the term on the screens the reader will use.

The AI draft read better than the source and was as wrong: it fixed the tone and kept the error. Vale flagged four things in step 5, all of them wording; none of them the false claim. Each factual claim went to the server’s recorded behaviour before publication.

7Automated Checks

Vale 3.28.1 runs the Google developer style, alex and Readability, plus house rules made from the audit: one term for one thing, sign in and set up as verbs, no minimizers and link text that names its target.

Every Vale run, as recorded
RunErrorsWarningsSuggestions
The original article756
The first migration264199
After review0872
After the 1.1 revision01285

The first migration had more findings than the article because it had about twenty times as much text, and the terminology page lists the forbidden words on purpose. Every finding was accepted or rejected with a reason: the decision record. Interface labels and Keycloak’s own messages are quoted, not written, so they’re out of scope; alex’s warning on the word period is off.

Vale didn’t find either critical problem of the original article. A linter checks words, not facts.

8Publication

Docusaurus 3.10.2 builds the pages: sidebar by purpose, page facts from front matter, an edit link to the source on every page, and a build that fails on any broken link or anchor. The build’s record is in quality/build.txt.

The published how-to, Reset a User's OTP Credential, in Docusaurus: the sidebar by purpose, the page facts and the identity check before you start

Open the published docs

9Localization Readiness

A pseudo-locale (qps-ploc) accents every letter, makes each string about 35% longer and brackets it. It isn’t a translation. Any word still plain on a pseudo page is a string a translator can’t reach.

The first pseudo-locale build: the page facts labels Type, For, Checked against, Owner and Last review are still in plain English
First build: five labels hard-coded in English.
The pseudo-locale build after the fix: every label is pseudo-localized
After the fix: nothing left in English.

The labels became literal translate() calls. A first attempt built the message ID from a variable, and Docusaurus refused to extract it. The 1.1 revision then added code blocks with titles; the check found those titles in English too. What the source does for translators: one term per thing, labels quoted from the product, one sentence per line, ISO dates, fixed heading IDs and no idioms.

10Maintenance

Version 1.1 adds a way to reset many users with Keycloak’s admin REST API: after an OTP policy change, every user needs a reset, and the console does one at a time. Every command ran as written against the server, and a sign-in afterwards reached Mobile Authenticator Setup.

Testing the commands found a trap the console hides: a PUT of a user’s required actions replaces the whole list.

What the server answered
Before["UPDATE_PROFILE"]
Sent{"requiredActions":["CONFIGURE_TOTP"]}
After["CONFIGURE_TOTP"]: the pending profile update was gone

So the guide reads the list first and adds to it, with a warning that says why.

Version 1.2: The Order of the Two Actions

A later security review of the steps asked what happens between them. Versions 1.0 and 1.1 deleted the credential first and added Configure OTP second. Signing in as the test user at that moment answered it:

What Keycloak asked for, between the two actions
OrderAsked for a codeSigned in with the password alone
Delete first (1.0, 1.1)NoYes
Required action first (1.2)YesNo

Version 1.2 adds the required action first, in the console and in the REST commands, and says why at the top of the steps. The film of the task, recorded on 19 November, still shows the first order; it is labelled as such until it is recorded again.

The recorded runs · The order test · The published steps · The Changes page

11Measurement

A proposal, not a report: this demonstration has no readers to measure, and I’ve invented no numbers. These are the questions I’d track for a page like this, and what I’d do with the answer.

QuestionSignalSourceAction
Can readers find it?Help-center and docs searches with no result, and the words usedSearch logsAdd the missing terms to titles, descriptions and redirects
Does it solve the task?"Was this helpful?" answers and comments, per pagePage feedback widgetRead every "no"; fix the step it names
Does it reduce support load?Tickets about second-factor resets per month, before and afterSupport tool tagsA rise after a release means a page is out of date
Is it still true?Days since last review against the review intervalFront matter and Git historyReview pages past due before a release
Is quality holding?Vale errors and broken links per pull requestCI checksBlock the merge above zero
Is it ready to translate?English left on pseudo-locale pagesscripts/check-pseudo.pyBlock the merge above zero

12Before and After

MeasureOriginal articlePublished docs
Pages17
Words of prose822635
Headings021
Steps in the task3, one of them wrong14, each checked on the server
Pictures with alternative text0 of 112 of 12
Owner, version, review dateNoneOn every page
Vale errors70
HistoryOne date, ambiguous8 commits, and a Changes page

Longer, on purpose: the original was short because it left out the identity check, the step that makes the reset safe, the check, the settings and the failures. A reader who only needs the task reads one page of it.