# Oauth SMTP Google

{% hint style="warning" %}
Google only accepts public AND secure (https) URLs. If your GLPI URL is not accessible from the internet, this procedure will not apply.
{% endhint %}

## Create a project

* From your [Google console](https://console.cloud.google.com/) (administrator access required), go to your **`organization`** and then select **`New Project`**.

![Create a project](/files/OIsXSnsKW0TdEr92CmvN)

* Enter your project name
* Click **`Create`**

<div align="left"><img src="/files/kZNlcYr4z8gPEuUi7ucR" alt="Configure project information"></div>

* Return to your organization,  \
  Select your project

![Sélection du projet nouvellement créé](/files/2xkBJFJcEB886heSZJRI)

## Configuring OAuth access

* In the menu, click on **`APIs & Services`**
* Then click on the **`OAuth Consent Screen`**.

<div align="left"><img src="/files/qccV7U80HGAMQrjvSWGW" alt="OAuth consent selection"></div>

### Overview

* In the **`Overview`** tab, click **`Get Started`**.
* Enter the application information.

<figure><img src="/files/hljAxzpFHrAmm1FHgKxv" alt=""><figcaption><p>Application information</p></figcaption></figure>

### Audience&#x20;

* The next tab takes you to the Audience section and allows you to specify who this application is intended for:
  * **Internal**: only users within the organization
  * **External**: anyone with a Google account

<figure><img src="/files/VHCy9bAm0vltZ6YHBKYU" alt=""><figcaption><p>Selection of the relevant audience</p></figcaption></figure>

### Contact information

Any changes to the created application will be sent to the contact identified in this section.

<figure><img src="/files/s3bwMXrVIwSDbWOz28V1" alt=""><figcaption><p>Contact information in case of application changes</p></figcaption></figure>

## Google API Services Privacy Policy

* Accept the privacy policy and click **Continue**.

<figure><img src="/files/ch1J4G2BLe1MWqh31PUO" alt=""><figcaption><p>Acceptance of the privacy policy</p></figcaption></figure>

## Clients

Creating the client will allow you to specify the redirection URL(s) (identified as **`callback`** in GLPI) as well as the client secret.

### Information

Specify the application type **`Web Application`** and the client name.

<figure><img src="/files/vXgwoZYXn1fV9cRvp6XP" alt=""><figcaption><p>Adding a web application</p></figcaption></figure>

### URI de redirection autorisés

L'URL de retour devra être indiquée dans cette partie. Cette URL est indiquée dans GLPI dans la section **`Configuration`** > **`Notifications`** > **`Configuration des notifications par email`**

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

<div align="left"><figure><img src="/files/1edOeyQtHqa1A02ElX08" alt=""><figcaption><p>URLs redirect authorised</p></figcaption></figure></div>

### Secret Client

{% hint style="warning" %}
In the next step, your customer secret will be displayed. Once you leave this screen, it will no longer be available. Remember to save it in a safe place.
{% endhint %}

The information on the next screen will need to be entered in GLPI **`Setup`**> **`Notifications`** > **`Email Notification Configuration`**

<div align="left"><figure><img src="/files/HAlVpJu4Sq2EZzyzXp6D" alt=""><figcaption><p>Visualizing customer secrets</p></figcaption></figure></div>

* Select Google in the **OAuth Provider** section.\
  Enter the **Client ID** and **Client Secret**.

<figure><img src="/files/ex0sLxQ97Q5Sate2HLS9" alt=""><figcaption><p>Reflection of information from the Google application in GLPI</p></figcaption></figure>

## Finalizing the configuration in GLPI

* Enter the information below in GLPI to finalize the configuration:&#x20;

| Champs             | Valeurs                                                                                                                                                                                   |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **`Hôte SMTP`**    | *smtp.gmail.com*                                                                                                                                                                          |
| **`Port`**         | *587*                                                                                                                                                                                     |
| **`Email sender`** | If empty, the value will be the **`sender's email address`**. If the value is different from the sender's email address, the configuration will fail; the two values ​​must be identical. |

<div align="left"><img src="/files/u98e1ddcxvNvlJ9rXnRc" alt="GLPI configuration finalized"></div>

* Click **`Save`**.

You will be asked for a Gmail account, and then you will need to grant the necessary permissions.

{% hint style="warning" %}
**Important**

The account synchronized with OAuth SMTP must also be the one sending the emails. This account is identified in the sender's email address.

<img src="/files/BjRG4ed6r2YpVHW3E8NN" alt="" data-size="original">
{% endhint %}

<div align="left"><img src="/files/CVDk2mAwkkOy7wwkeBvj" alt="Sending test"></div>


---

# 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://help.glpi-project.org/tutorials/notifications/oauth_smtp_google.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.
