How to enable 2FA (two-factor authentication) in CLI
How can 2-factor authentication help me?
2-factor authentication (2FA) adds one more layer to your login process, but it’s worth it. It helps protect your account even if someone steals your password. When trying to sign in, after you type in your password, you’ll also need to enter a code from your phone or app: even if someone knows your password, they still can’t get in, making it way harder to hack.

How to enable 2FA
Before using 2FA commands, use xcli login to get yourself a token. Failure to sign in before performing 2FA tasks will cause token errors.
Launch CLI
Launch Multilogin, then open Command Prompt or Terminal, go to the CLI folder and run CLI executable:
Windows
- Go to the CLI folder:
C:/Users/%username%/mlx/deps/cli - Run
xcli.exe
macOS
- Go to the CLI folder:
/Users/%username%/mlx/deps/cli - Run
./xcli:./xcli
Linux
- Go to the CLI folder:
/Home/%username%/mlx/deps/cli - Run
./xcli:./xcli
Follow the article for more details: How to start working with CLI.
Sign in to authenticate
In order to get your API token, you will need to first sign in to your account via the login command.
Paste this command: xcli login --username your username --password your password:
Windows
- Paste this prompt to sign in:
xcli login --username 'your username' --password 'your password' - Replace values of the flags (
--usernameand--password) with your email and password

macOS
- Paste this prompt to sign in:
./xcli login --username 'your username' --password 'your password' - Replace values of the flags (
--usernameand--password) with your email and password

Linux
- Paste this prompt to sign in:
./xcli login --username 'your username' --password 'your password' - Replace values of the flags (
--usernameand--password) with your email and password

Enable 2FA for the user
If you wish to activate 2FA for the current user in Multilogin CLI:
- Enter
xcli enable-2fa --device devicename-
devicename→ choose the name it will appear in the 2FA application
-
Windows
xcli enable-2fa --device devicenamemacOS/Linux
./xcli enable-2fa --device devicename- Once the command is parsed, the CLI tool will automatically generate a QR code

- Open your desired authenticator app (such as Google Authenticator, Microsoft Authenticator)
- Choose to add a new QR code and scan the output → this will create an entry in your authenticator app called
MLX- Note: if you already have an authenticator input called MLX, you will be prompted to choose a new name
- Find the code shown in your authenticator → type it into the code area
- Once done, you will see a success message alongside your backup codes. Store them in a safe place.

Backup codes are one-time-use codes, emergency keys that let you sign in if you lose access to your app or phone.
Enable 2FA for the workspace
Want to activate the use of 2FA for all users in the workspace, instead of just your own? Follow the steps below:
- Make sure you have completed all the steps to enable 2FA in the previous section
- Once the activation is complete, you are able to activate this same key for the workspace
- Enter
xcli enable-2fa-for-workspace
Windows
xcli enable-2fa-for-workspacemacOS/Linux
./xcli enable-2fa-for-workspaceHow to disable 2FA
Disable 2FA for the user
Disabling 2FA is even easier than enabling it! Just enter xcli disable-2fa-for-user and that's it! No flags needed. Your previously enabled 2FA will be turned off.
Windows
xcli disable-2fa-for-usermacOS/Linux
./xcli disable-2fa-for-userDisable 2FA for the workspace
Disabling 2FA for the workspace affects all its members. To proceed, just enter xcli disable-2fa-for-workspace, no extra flags needed.
Windows
xcli disable-2fa-for-workspacemacOS/Linux
./xcli disable-2fa-for-workspaceHow to view 2FA backup codes
Need to recheck your backup codes? It is as easy as one-step in CLI! It is easy to check what are your current backup codes. Just type view-backup-codes:
Windows
xcli view-backup-codesmacOS/Linux
./xcli view-backup-codes
2FA commands table
Command/Type |
For a specific user |
For everyone in the workspace |
Enable 2FA |
|
|
Disable 2FA |
|
|
View backup codes |
– |
|