# Setting up OAuth IMAP 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 %}

## Install the OAuth IMAP application

* From **`Setup`** > **`Plugins`**, install **`Oauth imap`**.

<div align="left"><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fsd0N4Q28osb8QUrvgcTc%2Faouth-imap-plugin-install.png?alt=media&#x26;token=6e5a1ec2-12ed-478d-9f93-d850b1a95638" alt="Install OAuth IMAP"></div>

***

## Creating a project

* From your [Google console](https://console.cloud.google.com/) (administrator access is required), go to your organisation then new project

![New project creation](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-d0225dba7cfd3eedab250dc831ce0767596da7c0%2Foauth-imap-google-1.png?alt=media)

* Enter the name of your project
* Click on **`Create`**

<div align="left"><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-6be36402f8cf7db3144c44319454ad8e013f016f%2Foauth-imap-google-2.png?alt=media" alt="Validation of new project"></div>

* Return to your organisation,
* Select your project

![Select the new project](https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-8176b8b40938b8f1bc00d417d44eef3f864bda69%2Foauth-imap-google-3.png?alt=media)

***

## Setting up Oauth access

* From the menu, click on **`APIs & Services`**.
* Then **`OAuth consent screen`**

<div align="left"><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2Fgit-blob-4fa4966bc534ad1cb953a4f6f49fdd78264c06b3%2Foauth-imap-google-4.png?alt=media" alt="Oauth consent screen"></div>

### Application Information

* From the preview, click **`Get started`**
* Enter the application name and the user support email (users will be able to contact you with questions regarding their consent)

<figure><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2F2gFIC0cL9KALDBJm3hAk%2Foauth-imap-app-information.png?alt=media&#x26;token=ef63c72c-bedd-4b93-a562-2847440c9e39" alt=""><figcaption><p>Application information</p></figcaption></figure>

### Audience

* Indicate what type of audience will be able to use this application (here internal because the user who will be using the imap services is a user of the organization)

<figure><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2F11CsjJVASWOWxB00HCd7%2Foauth-imap-audience.png?alt=media&#x26;token=ed3332ea-2bec-4156-a592-8fa3ed922bd8" alt=""><figcaption><p>Audience settings</p></figcaption></figure>

### Contact information

* Enter the contact name (this contact is notified of changes made to the application)

<figure><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2FTtvGQifHsnu2ha7SoNPg%2Foauth-imap-contact.png?alt=media&#x26;token=6391311b-10d3-4cd0-8e24-df3e9b2d92ee" alt=""><figcaption><p>Contact information</p></figcaption></figure>

***

## Google API Services User Data Policy

* Accept the Google API Services User Data Policy and click **`Continue`** and **`Create`**

<figure><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2FS3uAsinBFJh1G19itSeX%2Foauth-imap-data-policy.png?alt=media&#x26;token=cb79eb8e-e79b-45c3-bf16-af6285b95452" alt=""><figcaption><p>Application finalization</p></figcaption></figure>

***

## Creating a Client

### &#xD;Application Type

\
You now need to create an application client that will connect Google to your GLPI instance using an application ID and a client secret.

* In the **Clients** tab, click **`Create a client`**.
* Select **Web Application** as the application type.
* Enter a name for your application.

<figure><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2FQ5l6IvwX9xrIO3gvAmAW%2Foauth-imap-web-app.png?alt=media&#x26;token=88360074-e2d0-4e11-b907-ec953f3becee" alt=""><figcaption><p>Added the web application</p></figcaption></figure>

### Authorised redirect URIs

\
The return URL must be specified in this section. This URL is found in GLPI under **`Setup`** > **`OAuth IMAP`** > **`+ Add`**

<figure><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2FGzjl2Pc6eE7RQjymKT3z%2Foauth-imap-url-callback.png?alt=media&#x26;token=530867b9-3a29-45f6-aea5-7bc42ca1f45a" alt=""><figcaption><p>Retrieving the callback URL</p></figcaption></figure>

* Enter this URL in the **Authorised redirect URIs** section of your application.

<div align="left"><figure><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2FpClU4wZR6xdA1yqcHdFJ%2Foauth-imap-uris-authorisees.png?alt=media&#x26;token=d26cd194-71c5-4b03-ab66-cbaff98c43fa" alt=""><figcaption><p>Inserting the return URL</p></figcaption></figure></div>

* Click **`Create`** to validate your application

***

## Application information

{% hint style="warning" %}
In the next step, the **client 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 application is now created. The screen displays the application ID and the client secret, which you will need to enter in GLPI.

<div align="left"><figure><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2FtbMfmA2ulVTo8trjN0n0%2Foauth-imap-secret-client.png?alt=media&#x26;token=45e67057-d581-407d-b6d7-10a78239f7db" alt=""><figcaption></figcaption></figure></div>

<figure><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2FUtYZsEbqexkaRYqbuOsc%2Foauth-imap-info-glpi.png?alt=media&#x26;token=15441fba-43db-4c45-830a-df8672d6c1f4" alt=""><figcaption><p>Information entered in GLPI</p></figcaption></figure>

***

## Finalizing GLPI configuration

Once your application information is listed in GLPI, and your application is active, you can click on **`+ Add`**

<figure><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2FQoj8LhRZpiBhwMRcQ2UC%2Foauth-imap-created.png?alt=media&#x26;token=a98618f0-e3c4-41b6-9a3f-1d000f7a6726" alt=""><figcaption><p>OAuth IMAP application created</p></figcaption></figure>

### OAuth Authorization

OAuth authorization is required for GLPI to use the IMAP services for the mailbox in question.

* From the **OAuth Authorization** tab, click **`+ Create authorization`**.
* Specify the account authorized to use the IMAP services.

<figure><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2FV8FzLwMTH8n9o88uiexm%2Foauth-imap-authorization-oauth.png?alt=media&#x26;token=aa95f9b5-c90c-4481-88f0-6cc3f52517a5" alt=""><figcaption><p>OAuth Authorization</p></figcaption></figure>

***

## Receiver configuration

* From **`Configuration`** > **`Receivers`** > **`+ Add`**
* Specify the server **`imap.google.com`**
* In **Connection options**, select the previously created **IMAP OAuth** application
* In Username, select the user with OAuth permissions

<figure><img src="https://2961961068-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsGALtnzA2IROeldmXKt5%2Fuploads%2FaCwX3X6Ea1AFPMBpwupZ%2Foauth-imap-setup-receiver.png?alt=media&#x26;token=207e0875-16ba-4790-aa55-8d00855aed77" alt=""><figcaption><p>Receiver configuration</p></figcaption></figure>

***

## More information

For more information on receivers configuration, please refer to the following article:

<a href="collect_and_convert_mail_into_tickets" class="button secondary">Receivers configuration</a>


---

# 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/receivers/oauth_imap_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.
