# 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="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FcSgACzYIqaCqSKciOgQN%2FK%C3%A9perny%C5%91k%C3%A9p%202024-01-03%20114009.png?alt=media&#x26;token=5995a06c-8b5c-4d9d-87e4-d81fdb6ee8b8" 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="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2F4GklYWVs5KSfgDWWGfoW%2Fimage.png?alt=media&#x26;token=e795dd52-135f-488c-aac3-644f0645dc05" alt="" data-size="original"><br>
3. Navigate to the OAuth consent screen to configure it, if you do not have one already:\
   ![](https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2Fi4gYyF3KMn67nqOmT2Dz%2Fimage.png?alt=media\&token=b3108d87-f5f7-46bb-966d-e6ecd87477e8)
4. Click Get Started
   1. In App Information Enter the application name (for example, “Email This Issue”) and select a support email

      \
      ![](https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2F2gRs55nH4cnpYoHTqHcv%2Fimage.png?alt=media\&token=e5a5b0d9-871a-4d03-855c-0c4e44af9018)
   2. In Audience, select whether the app is Internal or External, according to your requirements:\
      ![](https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FvjoGGDfDVCO9gN5ZYrJH%2Fimage.png?alt=media\&token=d1abed53-f35c-4fbb-bdf1-f8a286732ccd)
   3. Enter contact information
   4. Agree to the User Data Policy\
      ![](https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FDBQ5AbbSOe6MOPzAE0Em%2Fimage.png?alt=media\&token=75f1d1ce-e32a-4e60-85e4-011d445d216d)
   5. Click create
5. Go to Branding and add meta-inf.hu as an authorized domain:\
   ![](https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FAWaErDBKhWikYvtfRm6a%2Fimage.png?alt=media\&token=265ec74f-c513-41fd-9747-3474308f78cc)

{% 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="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FVQsBTaGqKLEFBufSTidi%2Fimage.png?alt=media&#x26;token=c466043e-203b-453e-b6a1-0a74d315f3a8" alt=""><figcaption></figcaption></figure>
7. Select Web application as the application type, and give it a name\
   ![](https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FFrWX3nrW2kwk08ooda5E%2Fimage.png?alt=media\&token=79b2e4ce-f586-4d6f-b857-4417fcf0ada2)
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="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FulbLiybJGQ2w7xFgGuox%2Fimage.png?alt=media&#x26;token=9b070090-e504-4b92-92c5-92a63e9983bc" 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:\
    \
    ![](https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2F6qwgrGUZZmLNAjaIWVfe%2Fimage.png?alt=media\&token=5450dcbd-5a08-4e22-8a06-aa835c1bc3db)

{% 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="https://880912854-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-Mf8H-oTE_fhOrUtfYrN-2724419853%2Fuploads%2FvNMw3iIlVZSjdC9byVwq%2Fcreds_4.png?alt=media&#x26;token=db4afe80-457a-43a5-b2c1-51187c63fcd4" 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.<br>
