Summary
- An app-specific password bypasses two-factor authentication and allows you to log in to your Google, Microsoft, and other accounts in your apps.
- To create such a password on Google, access Google My Account, click Security > 2-Step Verification, and choose “App Passwords.”
- For Microsoft, access the Microsoft Account site, click Security > Manage How I Sign In, and choose “Create a New App Password.”
I wanted to log in to my email account in a script, but thanks to two-factor authentication, the login attempts failed. I then used an app-specific password, and it worked just fine. Here’s how to generate such a password for Gmail and Microsoft.
What Is an App-Specific Password?
An app-specific password, as the name implies, is a password you create for your online accounts to be used with a specific app. For example, if you use an app that only supports passwords and no other forms of authentication, and you’ve enabled two-factor authentication for your account, you’ll have to generate and use an app-specific password in your app to log in to your account.

Related
Warning: Your “Application-Specific Passwords” Aren’t Application-Specific
Application-specific passwords are more dangerous than they sound.
As you can see, when you use an app-specific password, you bypass the two-factor authentication process. Your username and the app-specific password you generate are enough to log in to your account.
This sometimes poses a security risk, as if someone discovers your app-specific password, they can log in to your account. In this case, you have the option to remove all or specific app-specific passwords from your accounts.
How to Generate an App-Specific Password on Google
I wrote a script to send emails using Gmail’s SMTP, but since the script didn’t support other forms of authentication, I created an app-specific password for my Google account to use in the script. Here’s how you can create one for your account.
Launch the Google My Account site and sign in to your Google account. For this login, you’ll have to use your password as well as two-factor authentication. After logging in, from the site’s left sidebar, select “Security.” On the right pane, in the How You Sign In to Google section, click “2-Step Verification.”
If prompted, enter your account password to continue.
On the 2-Step Verification screen, at the bottom, click the right-arrow icon next to App Passwords.
On the App Passwords page, click the “App Name” field and type the name of the app you want to create a password for. This name is only for your reference; you can type any name you want. Then, click “Create.”
A Generated App Password window will open. You’ll see the app-specific password that Google has generated for you. Copy the password and paste it directly into your app or temporarily save it somewhere safe. Then, close the window by clicking “Done.”
You’re back on the App Passwords page, and you’ll see the entry for your newly created app password. In the future, if you’d like to remove this password, you can click the trash icon next to the password.
Note that any apps using this password won’t be able to log in to your Google account anymore.

Related
How to Secure Your Gmail and Google Account
Out of all your online accounts, there’s a good chance that Google holds most of your information.
How to Generate an App-Specific Password on Microsoft
I sometimes also use Microsoft Outlook to send out emails from my script, and creating an app-specific password with Microsoft is also easy. To start, launch the Microsoft Account site and sign in to your account. You’ll have to use two-factor authentication.
From the left sidebar, select “Security” (the shield icon). On the right pane, click “Manage How I Sign In.”
On the open page, scroll down to the App Passwords section. Here, click “Create a New App Password.”
On the following page, you’ll see an app-specific password that Microsoft has generated for you. Copy the password and save it somewhere safe, or immediately use the password in your script or app. Then, click the “Done” button.
Unlike Google, Microsoft doesn’t allow you to remove app-specific passwords individually. It erases all your app-specific passwords at once. If you’d like to do that, click “Remove Existing App Passwords.” In the prompt that opens, choose “Remove.”
If you’d like to use certain apps with your Microsoft account in the future, you’ll have to re-generate app-specific passwords for all those apps in your Microsoft account. This is quite cumbersome, but this is the only option you currently have with Microsoft.

Related
Microsoft Authenticator is Losing Password Autofill—Here’s What To Use Instead
Don’t get caught by surprise when everything stops working.
And that’s how I generate and use app-specific passwords for my Google and Microsoft accounts. While you’re at it, consider learning some tips to secure your online accounts.
Leave a Comment
Your email address will not be published. Required fields are marked *