CodeTwo Base.title

How to use app passwords with CodeTwo software


You have an Office 365 account with multi-factor authentication (MFA) enabled that you want to use with CodeTwo products (listed in the Applies to section). When configuring a connection to Office 365, you receive the following error:

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


This error appears when you have MFA enabled and you use a regular account password instead of an app password when connecting to Office 365 in CodeTwo products. App passwords are created for each MFA-enabled account to allow signing in to non-browser applications.

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. Follow the steps below to do so.

  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 Apps 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 a 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.).It’s worth noting that app passwords don’t expire and can be used multiple times and in different programs at the same time.

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.


Our Clients: