Create a Gmail Application-Specific Password
To generate a new password for an email program to access your Gmail account through IMAP or POP with two-step authentication enabled:
Select your profile icon in the upper-right corner of Gmail, then select Manage Google Account. Select Security in the left sidebar. Select App passwords under the Signing into Google section. You’re then asked to confirm your Gmail login credentials. If you don’t see App passwords as an option, you must first turn on 2-Step Verification for Gmail. Under Select app, choose Mail or Other (Custom name), then select a device. Select Generate. Your password appears in a new window. Follow the on-screen instructions to complete the process, then select Done. You will not see the password again, so type or paste the password into the email program immediately.
Manage App-Specific Passwords
If you need to create a new app-specific password for a program or service, go back to the App Passwords screen to delete the old password that you previously set up but no longer use for the same application.
The value of an application-specific password is that you can revoke and regenerate a password on a service-by-service basis instead of changing the main password to your account. It’s best practice to use an app-specific password only for a single service. You are free to generate as many app-specific passwords as you like.