Sponsored byOutsenseAI that finds your next clients
SponsorGROUOutbound, LinkedIn content and leads for B2B teamsSponsorOutsenseAI that finds your next clientsAd+Your tool hereSeen by people installing AI tools@Weekly picksThe best new tools, one email a week

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.

  • Score 83
  • 2.3k stars
  • MIT
  • Updated
Works withClaude CodeClaude apps Antigravity CLI

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/mfa

Run in your terminal. Claude Code loads skills from ~/.claude/skills automatically.

Step-by-step: install mfa in Claude Code

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

A

No 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 →

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.

Add to stack

Loading.