# Configuration Client Credentials Flow (application) MS Graph API [ENG]

### Client Credential Flow Microsoft Graph API 

##### Configuration in Squeeze

[![image-1677680176067.png](https://docs.squeeze.one/uploads/images/gallery/2023-03/scaled-1680-/image-1677680176067.png)](https://docs.squeeze.one/uploads/images/gallery/2023-03/image-1677680176067.png)

<p class="callout info">In the first versions of this feature, the configuration had to be maintained using the "Username" and "Password" fields. We recommend an update.  
  
Expected value in the Username field: **maxMustermann@mustermann.de/{client\_id}/{tenant\_id}**  
Expected value in the Password field: **{client\_secret}**  
  
</p>

#### Folder - Configuration

In the folder configuration you need to specify three folders

1. **Inbox**  
    This folder is regularly checked to import the emails it contains.
2. **Done**  
    The successfully imported emails will be moved to this folder.
3. **Error** The emails that could not be imported (e.g. missing attachments) are stored in this folder.

[![image-1677680190121.png](https://docs.squeeze.one/uploads/images/gallery/2023-03/scaled-1680-/image-1677680190121.png)](https://docs.squeeze.one/uploads/images/gallery/2023-03/image-1677680190121.png)

<p class="callout warning">When defining the folders, please make sure that the names of the folders must be unique, since the folders are searched for in the directory structure of the mailbox.  
If a configured folder is not unique, this can lead to a different folder being used than the desired one. </p>

#### Configuration in AAD (Azure Active Directory)

Other necessary steps for a smooth process are the setup of an Azure Active Directory Application  
with a Client Secret. The global registration of a mail service of "Dexpro" in the Azure Active Directory of the customer is not offered for the time being.  
  
In addition, it must be ensured that the application has the following scopes.

[![image-1663665552831.png](https://docs.squeeze.one/uploads/images/gallery/2022-09/scaled-1680-/image-1663665552831.png)](https://docs.squeeze.one/uploads/images/gallery/2022-09/image-1663665552831.png)

<p class="callout danger">By default, this application now has access to all mailboxes.  
  
If you want to restrict this access to individual mailboxes, additional configurations must be made in Exchange Online, the AAD and using PowerShell.  
  
This documentation from Microsoft describes how to set this up using Group Policy: [Managing Group Policy in Azure AAD](https://learn.microsoft.com/en-us/graph/auth-limit-mailbox-access).  
  
If the Microsoft article is not sufficiently supportive, we have made a [guide](https://docs.squeeze.one/books/squeeze-2-admin-handbuch/page/leitfaden-zugriff-auf-exchange-online-postfacher-einschranken) that is more detailed.</p>