How to use app passwords with CodeTwo software


You have an Office 365 account with multi-factor authentication (MFA) enabled. You want to use this account with CodeTwo products (listed in the Applies to section).

If your account has MFA and you use a regular account password when connecting to Office 365 in CodeTwo products, you might get the following error:

The request failed. The remote server returned an error (401) Unauthorized.


To be able to sign in to Office 365 when using CodeTwo software, you need to use the app password instead of your regular password.

App passwords are created for each MFA-enabled account to allow signing in to non-browser applications. App passwords don’t expire and can be used multiple times and in different programs at the same time.

An initial app password is generated automatically after logging in to Office 365 for the first time after enabling MFA (Fig. 1.).

Fig. 1. An app password generated after enabling MFA for an Office 365 account.

If you didn’t save this initial app password, you can always generate a new one. To generate a new app password in Office 365, you need to:

  1. Log in to Office 365.
  2. Open the My account page (Fig. 2.).

Fig. 2. Accessing My account page in Office 365.

  1. On the Security & privacy tab, click Additional security verification. Some extra options will appear (Fig. 3.).

Fig. 3. Additional security options in Office 365.

  1. Click Update your phone numbers used for account security. A new window will open.
  2. Go to the App Passwords tab and click create (Fig. 4.).

Fig. 4. Generating a new app password.

  1. Type any name you want (Fig. 5.) and click next.

Fig. 5. Providing the name for your app password.

  1. In the next window, your app password will be displayed (Fig. 6.).

Fig. 6. Newly generated app password.


Remember to save this password or use the copy password to clipboard button before you close the window. You won’t be able to display this app password again, so if you forget it, you will need to create a new one.

You can now use this app password when configuring a connection to Office 365 in CodeTwo software. Simply provide this password instead of your regular Office 365 password for your account (Fig. 7.).

Fig. 7. Example of using the app password in CodeTwo Office 365 Migration.


If you cannot create app passwords, go to the multi-factor authentication page and make sure that on the service settings tab, under app passwords, the Allow users to create app passwords to sign in to non-browser apps option is selected (Fig. 8.).

Fig. 8. Enabling users to create app passwords.

If you don’t have access to this page, contact your administrator.