Knowledge Base

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 on the Security & privacy page in Office 365 by accessing the Additional security verification options (as shown in Fig. 3.).


Bear in mind that in case Microsoft security policies have been enabled, these options may not be available to you. If so, please refer to this article first.

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 to expand the available options and then click Create and manage app passwords (Fig. 3.). A new window will open.

Additional security verification options in Office 365
Fig. 3. Additional security options in Office 365.

  1. While you're on the app passwords tab, click the create button (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 password in your CodeTwo software to connect to Office 365. Use the app password instead of your regular Office 365 password (Fig. 7.). 

An example of using an app password in CodeTwo Email Signatures for Office 365 - Custom Attributes Sync App.
Fig. 7. An example of using an app password in CodeTwo Email Signatures for Office 365 - Custom Attributes Sync App.


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.