Skip to content

Latest commit

 

History

History
95 lines (53 loc) · 4.85 KB

GoogleAuth.md

File metadata and controls

95 lines (53 loc) · 4.85 KB

Google Security

We will be sending e-mail with Gmail. So the first thing we need to do is setup Google security.

On May 30th, 2022 Gmail removed the setting to allow "less secure" applications to access an account with just username and password.

Less secure apps & your Google Account

What this means is that you have to enable some other means of account security.

One way to do it is to use API Authentication with OAuth2 which Google documents here.

Another way, which I will describe here, is to turn on two-factor authentication.

Two-factor Authentication

In order to allow our Python client script to access Gmail accounts we will enable two-factor authentication (2FA) which Google calls " 2-step verification".

With 2FA you add an extra layer of security to your account in case your password is stolen. After you set it up, you’ll sign in to your account in two steps using:

  • something you know, like your password and
  • something you have, like your phone.

To enable 2FA:

  1. Open your Google Account.
  2. In the navigation panel, select Security.
  3. Under “Signing in to Google,” select 2-Step Verification

Signing in to Google: 2-step Verification


Signing in to Google: 2-step Verification (close-up)

Click the blue GET STARTED button:

3

Login using your password. Make sure you are using the right account.

Google login

Enter your phone number and click SEND:

Phone number

Wait for the confirmation code to arrive and enter it in:

Confirmation code

Click the TURN ON button:

Turn on

2FA should now be enabled:

2FA on

App Passwords

Now we will generate a special password that our app can use as the 2-step verification.

Back in the Signing in to Google panel select "App passwords" to add a new password:

App passwords: none

Under the "Select app" drop-down select " Other":

App passwords: other

Give your app a name and click GENERATE:

App passwords: generate

Write down (copy to clipboard) your generated password to use in the app:

App password: generated

We should now have our generated app password:

App password: list

Note:

Use App password instead of your account password.

Article Source