This article explains how to generate app passwords in Gmail for your connected email clients (e.g. Microsoft Outlook, Mozilla Thunderbird, and others).
To generate a new password for an email program to access your Gmail account via IMAP or POP with two-step verification enabled, follow these steps:
Select your profile icon in the top right corner of Gmail, then select Manage Google Account.
Select Security from the left sidebar.