> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abbyy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Microsoft Graph API connection error

> Fix the Connect to token endpoint failed error during Microsoft Graph Mail API import in ABBYY FlexiCapture by unblocking the Microsoft identity resources.

Setting up image import through the Microsoft Graph Mail API requires authorization through OAuth 2.0. Authorization is sometimes confirmed and then denied, with the error `Flow failed. Failure info/error: Connect to token endpoint failed`.

## Why the error occurs

FlexiCapture cannot reach one or both of the resources it needs:

* The token endpoint of the Microsoft identity platform, `https://login.microsoftonline.com/common/oauth2/v2.0/token`
* The Microsoft Graph API, `https://graph.microsoft.com`

## How the authorization flow connects

FlexiCapture contacts the ABBYY servers only once, during the first authorization.

After Microsoft authorizes the user, it redirects them to `https://go.abbyy.com/oauth2redirect`. That address redirects them again, to `http://127.0.0.1:32023`. The OAuth 2.0 authorization wizard listens on port `32023` for this final response.

FlexiCapture then sends its requests to the Microsoft resources directly, from the machine where the station is installed.

## Check your firewall settings

Confirm that your firewall does not block the Microsoft identity platform or the Microsoft Graph API servers.

Both resources must be reachable from the machine that performs any of these operations:

* Creating or editing a Microsoft Graph Mail API import profile on the Project Setup Station
* Starting image import manually on the Scanning Station or the Project Setup Station, which needs access from both stations
* Running automatic import from the Microsoft Graph Mail API Hot Folder on the Processing Station
