> For the complete documentation index, see [llms.txt](https://help.glpi-project.org/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.glpi-project.org/faq/plugins/oauth-imap.md).

# OAuth IMAP

***

### How do I install OAuth IMAP?

You will find a [procedure](/doc-plugins/plugins-glpi/oauthimap.md) to help you install and configure the plugin.

***

### What are the features of OAuth IMAP?

OAuth IMAP allows one of your tenant accounts to use IMAP services securely. With OAuth IMAP you can, for example, use the collector with a company mailbox.

***

### Is the MFA compatible with OAuth IMAP?

Yes, you can use OAuth IMAP with the MFA. You will be asked for 1st authentication when requesting **`creation of authorisation`**.

***

### I have a security policy requiring daily logon with dual authentication, does this also affect the account using OAuth IMAP?

The Oauth tokens for the collector, retrieved during authentication with Azure by the OauthIMAP plugin, are "offline" tokens that delegate authorisation to a third-party application (GLPI). These tokens provide a renewal code that will be used by the application to renew them automatically without user intervention. The daily re-authentication strategy only concerns 'online' authentication and only applies to services accessed directly by the user, for example via their Internet browser.

***

### I have a connection error, how can I fix it?

From **`setup`** > **`OAuth IMAP applications`**, tab **`OAuth authorisation`** click on **`diagnose`**. In the window that opens, increase the **`timeout`** to 15 (minimum). An error message will appear at the bottom of the log to guide you to the problem you are experiencing.

If you have changed the password for the account using IMAP services, remember to update the account from **`configuration`** > **`OAuth IMAP applications`**, tab **`OAuth authorisation`**, button **`update`**.

***

### Where are the application logs (on-premise only)?

If you have a problem, you can check the **`php-errors.log`** logs in the **`files/_log`** folder with the command (for example) `tail -f php-errors.log | grep "imap" -C5`

```
glpi_files/_log$ tail -f php-errors.log | grep "imap" -C5
[2024-01-18 16:20:04] glpiphplog.CRITICAL: *** Uncaught Exception Laminas\Mail\Storage\Exception\RuntimeException: cannot login, user or password wrong in /myinstancemondomaine.fr/marketplace/oauthimap/inc/imap/imapoauthstorage.class.php at line 76
 Backtrace :
...authimap/inc/mailcollectorfeature.class.php:101 GlpiPlugin\Oauthimap\Imap\ImapOauthStorage->__construct()
src/Toolbox.php:2222 GlpiPlugin\Oauthimap\MailCollectorFeature::GlpiPlugin\Oauthimap\{closure}()
src/MailCollector.php:1434 Toolbox::getMailServerStorageInstance()
src/MailCollector.php:708 MailCollector->connect()
src/MailCollector.php:1921 MailCollector->collect()
src/CronTask.php:1037 MailCollector::cronMailgate()
front/cron.php:87 CronTask::launch()
```

In this example, we can see that there is a problem with the user and/or the password.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://help.glpi-project.org/faq/plugins/oauth-imap.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
