# urbestack-login-second-factor

First published 3 Oct 2026 (release 0.1.0) · Unchanged since publication

UrbeStack release 0.2.35 command, run as root in the server shell.

## Usage

```
urbestack-login-second-factor --address IP [--recovery] [--agent TEXT] < challenge-and-code
```

## Description

Verifies the second factor for a login and opens a session when the code is accepted. Put the challenge returned by the first step on the first line of standard input and the authenticator app code on the second. Use --recovery to supply a recovery code. An accepted recovery code can only be used once. Use --address for the client IP address that started the login. The session is bound to that IP address. --agent records the browser's user agent with the session, up to 255 characters.

Success returns verified true with the session token and consumes the challenge. Failure returns verified false with a reason. The reason wrong includes the number of tries left. The fifth wrong code ends the challenge and returns dead with zero tries left. The reason expired means the challenge is missing, has expired, belongs to an inactive account or was issued for a different IP address. Submitting a challenge from a different IP address invalidates it.

## Same in the API

- [POST /auth/login/second-factor](https://urbestack.com/docs/api/post-auth-login-second-factor.md): Complete sign-in with an authenticator app code or a recovery code

## Command family: login

- [urbestack-login-flag-list](https://urbestack.com/docs/commands/urbestack-login-flag-list.md): Lists login flags newest first and reports the current login policy thresholds.
- [urbestack-login-refuse](https://urbestack.com/docs/commands/urbestack-login-refuse.md): Refuses logins from the IP address given by --address, even with a correct password.
- [urbestack-login-unflag](https://urbestack.com/docs/commands/urbestack-login-unflag.md): Lifts the active login flag for the IP address given by --address so it can try to log in again immediately.
