# Gmail with OAuth2

To connect to a Gmail address, you must first set up OAuth 2.0 credentials.

1. Log in to your Google account
2. Visit the following link in your Google account:
   * <https://console.cloud.google.com/apis/dashboard>
   * If this is the first time you are here, do the following:

     * Accept the Terms of Service:

     <div align="left"><figure><img src="/files/GJOExdV4aKSLzi7yPzDy" alt="" width="279"><figcaption></figcaption></figure></div>

     * Agree to the Terms of Service, then click **Agree and continue**.
   * If you have already agreed to the Terms of Service, you can select one of your existing projects or create a new one:\ <img src="/files/WoAU5LzYpQsOWR0hCgLO" alt="" data-size="original"><br>
3. Navigate to the OAuth consent screen to configure it, if you do not have one already:\
   ![](/files/EKExMK17EzLJj1uDF4oT)
4. Click Get Started
   1. In App Information, enter the application name (for example, “Email This Issue”) and select a support email

      \
      ![](/files/Os93FJu35vFi62YqU8y0)
   2. In Audience, select whether the app is Internal or External, according to your requirements:\
      ![](/files/kZSo8OYxLkqv1TJCpk8R)
   3. Enter contact information
   4. Agree to the User Data Policy\
      ![](/files/G51haBq8R7yiab8BQtyK)
   5. Click create
5. Go to Branding and add meta-inf.hu as an authorized domain:\
   ![](/files/06knIjIfDcBv3uN0locF)

{% hint style="warning" %}

#### Additional Step for External applications:

Go to the **Audience** menu and either add the authorizing user as a **Test user** or **publish** the application; otherwise, you will not be able to authenticate the connection.
{% endhint %}

6. Go to the **Clients** menu and click **Create Client**. If you already had a Consent screen, go to Credentials, click Create credentials, and choose OAuth client ID.\ <br>

   <figure><img src="/files/vOFdGnOxfJH4e90KqBsh" alt=""><figcaption></figcaption></figure>
7. Select Web application as the application type, and give it a name\
   ![](/files/KNeWwQ66MavxSN0BW5FZ)
8. Open Email This Issue and on the Admin tab go to **OAuth2 credentials**. Click to **Create** new credentials, select **Google** as the service provider, then copy and paste the **Redirect URI** from the bottom to the **Authorized redirect URI** in Google:<br>

   <figure><img src="/files/WQmOkP2Ftn9KjlvuaS8i" alt=""><figcaption></figcaption></figure>
9. Click **Create** in Google to create the client.
10. Copy the Client ID and Client secret to the appropriate fields in Email This Issue:\ <br>

    <figure><img src="/files/neaOFpwG86i12LkZhTno" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Note: The client secret is only blurred for data protection purposes in this example.
{% endhint %}

11. In Email This Issue, add the following endpoints:

* Auth Endpoint URL: <https://accounts.google.com/o/oauth2/auth>
* Token Endpoint URL: <https://oauth2.googleapis.com/token>

<figure><img src="/files/JX2IJfRz34WbTYZRw5Xz" alt=""><figcaption><p>Edit OAuth2 Credentials</p></figcaption></figure>

13. Click on **Save**, and you are ready to use the created credentials in your incoming or outgoing connection.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.meta-inf.hu/email-this-issue/email-this-issue-for-jira-server-data-center/documentation/administration/mail-server-connections/gmail-with-oauth2.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
