You are currently viewing How to Setup Gmail with OAuth2

How to Setup Gmail with OAuth2

Sending emails is a basic need for both personal and professional communication. Gmail, one of the most popular email services, has a feature that makes sending emails even more secure and reliable. This feature is called OAuth2. In this blog, we’ll talk about what OAuth2 is, why it’s important for your Gmail account, and how you can set it up in easy steps. So, let’s get started.

What is OAuth2?

OAuth2 is like a special key that allows different software and apps to access your Gmail without needing to know your actual password. It’s a safer way to let apps send emails on your behalf because if something goes wrong, you can just cancel this key without changing your password. Plus, it makes sure that the app follows Google’s rules for accessing your emails.

Why Use OAuth2 for Gmail?

Using OAuth2 with Gmail has several benefits:

  • Security: It keeps your Gmail account safer because you don’t have to share your password with other apps or services.
  • Control: You can decide exactly what parts of your Gmail account an app can use. For example, an app can only send emails but can’t read them.
  • Peace of Mind: If you ever feel like an app shouldn’t access your Gmail anymore, you can easily stop it without having to change your password.

Setting Up Gmail with OAuth2 in Google Cloud Platform

1. Begin by accessing Google Cloud Platform and selecting or creating a new project by clicking on “Select a project”.

Setting Up Gmail with OAuth2 in Google Cloud Platform 1

2. Proceed to name your project, optionally specify a location, and then click “Create”.

Setting Up Gmail with OAuth2 in Google Cloud Platform 2

3. Next, navigate to the “APIs & Services” from the menu on the left, then go to “Enabled APIs & services”.

Setting Up Gmail with OAuth2 in Google Cloud Platform 3

4. To add the Gmail API to your project, click on “+ENABLE APIS AND SERVICES”.

Setting Up Gmail with OAuth2 in Google Cloud Platform 4

5. Search for “Gmail” in the search bar and select the Gmail API from the results.

Setting Up Gmail with OAuth2 in Google Cloud Platform 5

6. Activate the Gmail API by clicking on the “Enable” button.

Setting Up Gmail with OAuth2 in Google Cloud Platform 6

7. After enabling, you’ll be prompted to create credentials to use the Gmail API. Click “Create Credentials” to continue.

Setting Up Gmail with OAuth2 in Google Cloud Platform 7

8. In the credential creation window, under “Credential Type”, select the Gmail API in the “Select an API” field, opt for “User data”, and press “Next”.

Setting Up Gmail with OAuth2 in Google Cloud Platform 8

9. In the “Scopes” section, choose “Add or Remove Scopes”. Then, in the “Update selected scopes” window, search for the Gmail API, select the …/auth/gmail.modify scope, and hit “Update”.

Setting Up Gmail with OAuth2 in Google Cloud Platform 9

10. For the OAuth Client ID section, choose “Web application” as the application type, and assign a name to your OAuth2 client.

Setting Up Gmail with OAuth2 in Google Cloud Platform 10

11. Add your authorized redirect URL by clicking “Add URI” and entering https://helper.myq.cz/. This is crucial for the authorization code to function properly.

Setting Up Gmail with OAuth2 in Google Cloud Platform 11

12. In the “OAuth consent screen” section, select “Add Users” and input the email addresses of users who will send emails or receive print jobs via email.

13. After completing all steps, click “Create”.

14. To access your Client ID and Client secret, which are necessary for the MyQ setup, go to “APIs & Services” and then “Credentials”.

Setting Up Gmail with OAuth2 in Google Cloud Platform 14

Configuring Gmail in MyQ

1. After completing the setup on Google Cloud Platform, sign into the MyQ web admin interface, and navigate to MyQ, then Settings, followed by External Systems.

2. Within the External Systems area, select +Add and choose Gmail.

Configuring Gmail in MyQ 1

3. A dialog box will appear where you need to enter the necessary information, then press OK:

Configuring Gmail in MyQ 2
  • Title: Enter a name for your Gmail external system setup.
  • Client ID: Input the Client ID obtained from your Google Cloud Platform credentials.
  • Security key: Enter the Client secret provided by your Google Cloud Platform credentials.

4. Following the configuration of the external system in MyQ, you will be prompted to authorize the integration. Do this by visiting the given URL, retrieving the authorization code, entering it into the Authorization code field, and then clicking OK.

Configuring Gmail in MyQ 3

With these steps completed, Gmail is successfully linked to MyQ. It can now be utilized as an Outgoing SMTP server under the Network settings tab, and as a POP3 or IMAP server in the Jobs settings tab for Jobs via Email.

Conclusion

Using OAuth2 with Gmail is a smart move for anyone looking to keep their email secure and manage third-party app permissions effectively. Although the setup process involves several steps, the increased security and peace of mind it offers are well worth the effort. Remember, in the world of online communication, taking extra steps to protect your privacy and security is always a good idea.