mfa
Skill by auth0
Adds multi-factor authentication to Next.js apps built with @auth0/nextjs-auth0 v4. It is for developers who need step-up MFA on sensitive actions and the MFA management API.
Install mfa
Built from the published package, never by AI.
git clone --depth 1 https://github.com/auth0/nextjs-auth0 /tmp/nextjs-auth0 && mkdir -p ~/.claude/skills && cp -r /tmp/nextjs-auth0/skills/mfa ~/.claude/skills/mfaRun in your terminal. Claude Code loads skills from ~/.claude/skills automatically.
git clone --depth 1 https://github.com/auth0/nextjs-auth0 /tmp/nextjs-auth0 && mkdir -p ~/.gemini/antigravity-cli/skills && cp -r /tmp/nextjs-auth0/skills/mfa ~/.gemini/antigravity-cli/skills/mfaAntigravity CLI loads skills from ~/.gemini/antigravity-cli/skills, or .agents/skills for one project.
Skills can run scripts on your machine. Some need an API key: check the README.
About
This skill covers multi-factor authentication in @auth0/nextjs-auth0 v4 for Next.js. It describes redirect step-up through Auth0 Universal Login, where the amr claim gates an action and the login route is called with the PAPE acr_values and max_age=0. It also covers server-side step-up when MFA is required, using an httpOnly cookie to pass the mfa_token to an MFA page.
The skill documents the MFA management API (getAuthenticators, enroll, challenge and verify), reactive step-up with mfa.challengeWithPopup() in client components, the beforeSessionSaved hook that stores amr on the session, and the MFA error classes. It is written for developers building Next.js apps with Auth0 who need MFA on sensitive actions.
Written from the project's SKILL.md and checked against it.
What it can do
- Redirect step-upRedirects users through Universal Login to complete MFA before a sensitive action.
- Server-side step-upHandles MfaRequiredError from a token refresh and sends the user to an MFA page.
- MFA management APILists, enrolls, challenges and verifies authenticators through auth0.mfa methods.
- Popup step-upRuns reactive step-up in a popup with mfa.challengeWithPopup() from a click handler.
- amr session hookUses beforeSessionSaved to copy the amr claim onto session.user for server checks.
- Secure mfa_token handoffStores the mfa_token in an httpOnly cookie tied to the user's sub claim.
- MFA error classesProvides typed errors such as MfaRequiredError, MfaTokenExpiredError and MfaVerifyError.
What you need
- @auth0/nextjs-auth0 v4.15.0 or later
- @auth0/nextjs-auth0 v4.19.0 or later for popup step-up
- The nextjs-auth0 skill, which this skill requires
Try asking
- Add step-up MFA to my transfer page using Auth0 Universal Login
- Set up the beforeSessionSaved hook so session.user.amr is stored
- Add a button that runs mfa.challengeWithPopup for my API call
Good to know
- mfa.challengeWithPopup() must run from a direct user-gesture handler, not an async catch
- Popup step-up needs cspNonce set on Auth0Client when a CSP blocks inline scripts
- A frontend amr check is for UX only and must be enforced on the server
Security check
ANo download-and-run commands, hidden instructions or signs of sending keys out were found.
Checked automatically: skills/mfa/SKILL.md. This looks for known risky patterns and is not a full audit. How grades work
Inside the skill
-
SKILL.md8 KB
Alternatives to mfa
All alternatives →Retrieves lab biomarker results and clinician notes from Function Health through its FHIR API. It is for people who want an AI assistant to review their own lab history and notes.
Gives an AI assistant a methodology for finding and exploiting privilege escalation weaknesses on Windows systems during authorized penetration tests. It is for security testers and defenders validating escalation paths.
Guides the assistant through designing, debugging and hardening GitHub Actions CI/CD workflows. It is aimed at teams that run production pipelines on GitHub.
Develops evidence-backed structural security hardening proposals from disclosures, findings, source code, or Codex Security scans. It is for teams that need systemic fixes and architectural tradeoffs.
Claude Security scans code for security issues with Claude Code. It covers whole repositories, branch or pull request diffs, single commits, and existing findings from SARIF files or earlier reports.
Turns vulnerability notes, disclosure reports, PoCs, source code, or Codex Security findings into self-contained vulnerability reports. Built for security researchers who need claims the evidence supports.
Compare with function_health, windows-privilege-escalation or github-actions-advanced
mfa: common questions
How do I trigger MFA step-up with nextjs-auth0 v4?
The skill describes redirecting to /auth/login with acr_values and max_age=0, or calling auth0.startInteractiveLogin in a Route Handler. v4 has no handleLogin export.
Why is session.user.amr undefined?
v4 persists only a default claim subset, so amr is dropped unless a beforeSessionSaved hook copies it from the ID token.
Which errors does the MFA module throw?
The source lists MfaRequiredError, MfaNoAvailableFactorsError, MfaTokenExpiredError, MfaTokenInvalidError and several other Mfa error classes from @auth0/nextjs-auth0/errors.
How do I install mfa?
Run the command above to copy the skill into ~/.claude/skills/. Claude Code picks it up automatically.
Is mfa free?
The code is published under the MIT licence. The service it connects to may have its own pricing.
Is mfa safe to use?
It scores 83 of 100. Grades: maintenance A, licence A, quality A. Security check: grade A, no risky patterns found in the files checked. Review the code before you install. How grades work.
What are alternatives to mfa?
Similar skills: function_health, windows-privilege-escalation, github-actions-advanced, propose-security-hardening.
