1. Sign in to Office 365 and go to the  My Account  page.
  2. Choose  Security & PrivacyAdditional security verification. You'll only see this option if your admin has set up multi-factor authentication for your organization. If you don't see this option, contact your Office 365 admin and tell them to turn on multi-factor authentication.
  3. At the top of the page, choose  App Passwords.
  4. Choose  create to get an app password.
  5. If prompted, type a name for your app password, and click  Next.

  6. Choose  copy password to clipboard. You won't need to memorize this password.

  7. Go to the app that you want to connect to your Office 365 account. When prompted to enter a password, paste the app password in the box.

Source:  https://support.office.com/en-us/article/create-an-app-password-for-office-365-3e7c860f-bda4-4441-a618-b53953ee1183