---
title: "Require a code in one app | FoxAuth"
description: "One app, such as billing, lets nobody in without a code from an authenticator app, while the other apps of the project stay as they are."
canonical: "https://foxauth.dev/docs/get-started/require-a-code-for-an-app/"
lastmod: "2026-11-11T10:59:03+03:00"
---
Require a code in one app

Some apps hold more than others. A billing app or an admin tool should not open for someone who only learned a
password. This page shows how to make one app require a code from an authenticator app, without changing the
project’s other apps.

Turn it onSection titled “Turn it on”

Open the app in the console, on its Settings tab.

Switch on Require a code from an authenticator app and save.

Before anything changes, the console shows how many people this reaches:

people who sign in with a password and have no authenticator app. They will be asked to set one up, or turned
away if your project does not let people do that themselves;

people who can sign in only through a provider. They will be turned away;

people who hold a sign-in to the app now.

Confirm. The app’s line in the list now says Code required.

An agent does the same with client_update (requireCode). It is a high-consequence change, and the agent gets the
same numbers to confirm.

What a person seesSection titled “What a person sees”

A code is asked once per sign-in, not every time the app opens.

They have a code. They type their password, then the code. Someone already signed in with a code is asked
nothing.

They have none. After the password, a page says the app asks for a code from an authenticator app. They can
choose Set up an authenticator app: FoxAuth emails them a link, they open it in the same browser, scan a QR code
and type the code. Continue takes them into the app in the same sign-in.

Your project does not let people set one up. The page says so and asks them to contact you.

They signed in through a provider. The page names the provider and says this way of signing in cannot open the
app. If their account also has a password, it offers Sign in with a password instead.

Every version of the page has Return to the app without signing in. The app then receives the error
unmet_authentication_requirements. Make sure the app shows a helpful page for it.

Caution

People who sign in only through a provider cannot open the app while this is
on. Check the number the console shows before you confirm.

TokensSection titled “Tokens”

Sign-ins that already happened keep working until the app renews its tokens. A refresh token from a sign-in without
a code then stops working, and the person signs in again, this time with a code.

The same rule holds for device sign-ins and CIBA.

Assertion grants (JWT bearer and identity assertions) are refused, because no code was typed here. A token exchange
works only when the sign-in behind it included a code.

A client credentials token, which acts for no person, is not affected.

There is no “code within the last N hours” rule. A sign-in with a code is enough, however long ago it was.

Ask for a code only on some pagesSection titled “Ask for a code only on some pages”

Leave the switch off and ask for a code where you need it. Send acr_values with your server’s multi-factor value,
which the app’s Connect tab shows, and check acr in the ID token. Under the IPSIE SL1 profile, or with an
essential acr claim, the request is binding. Otherwise it is only a request, so the app must check the ID token.

An app behind your proxy asks for a code on a path instead: see
Add conditions at your proxy.

Rolling backSection titled “Rolling back”

db:migrate records a migration after which an older release refuses to start against the database. An older
release does not know the setting and would let people in without a code.

PreviousLet people turn on two-step verificationNextDeploy to Fly.io
