Skip to main content
Microsoft Graph Mail API import relies on OAuth 2.0 sign-in, the Token Management Service on the Application Server, and network access to Microsoft. If any of these fails, an error appears when you sign in or when the import runs. For the components that each computer needs, see Components required for Microsoft Graph import.

How sign-in connects to Microsoft

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. The Token Management Service then stores the tokens in the FlexiCapture database and refreshes them. FlexiCapture sends its requests to the Microsoft resources directly, from the machine where the station is installed.

Fix the Connect to token endpoint failed error

Sometimes Microsoft confirms authorization, but sign-in then fails with the error Flow failed. Failure info/error: Connect to token endpoint failed. The error can also appear as a longer ChilkatLog: RefreshAccessToken message that ends with Failed to connect to token endpoint.

Unblock the Microsoft resources

FlexiCapture must reach both of these resources:
  • 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
Confirm that your firewall does not block them. 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

Reconnect the Token Management Service to the database

The Token Management Service gets its database connection when you connect the Application Server to a database. After an upgrade, the connection can be missing. FlexiCapture then cannot store the refresh token, and sign-in fails.
1

Stop the import

Stop the import in the project, and wait until all batches finish processing.
2

Reconnect the Application Server to the database

In the Administration and Monitoring Console, click Settings → Application Server, and then click Connect to Existing Database. Enter the connection details and click OK. For more information, see Connect to an existing database.
3

Check the connection strings

On the Application Server computer, open the appsettings.json file in the Token Management Service folder under C:\inetpub\wwwroot. In both the Database and DbDistributedLocks sections, make sure that ConnectionString is not empty.If SQL Server uses a certificate that the Application Server computer does not trust, add TrustServerCertificate=yes to both connection strings.
4

Restart the Token Management Service

In IIS Manager, select Sites → FlexiCapture 12 Token Management and click Restart.
5

Recreate the import profiles

In the Project Setup Station, delete each Microsoft Graph Mail API import profile and create it again.

Fix the site cannot be reached error during sign-in

During sign-in, the browser can fail to open go.abbyy.com and show the message This site can't be reached. This means the computer where you sign in cannot reach the ABBYY redirect page. Complete the sign-in on another computer that can reach it.
1

Copy the authorization link

In the Project Setup Station, open the properties of the Microsoft Graph Mail API import profile and click Sign in…. Copy the authorization link that the wizard shows.
2

Sign in on another computer

On a computer that can reach go.abbyy.com, paste the link into a browser. Sign in to your Microsoft account and grant the permissions. This computer does not need any FlexiCapture components.
3

Return the final redirect to the Project Setup Station

If the final redirect to http://127.0.0.1:32023 fails on that computer, copy the full address from the browser. Paste it into a browser on the Project Setup Station computer, where the wizard is waiting for the response.

Fix the expired OAuth secret error

Sign-in or mailbox import fails with the error ERR_OAUTH_SECRET_EXPIRED. The OAuth component, OAuthProviders.dll, contains a credential that has expired. The error affects every Microsoft OAuth 2.0 connection, including Microsoft Graph Mail API, IMAP, and SharePoint.
1

Update FlexiCapture

Install FlexiCapture 12 Release 4 Update 9 or later. This release no longer uses the expired credential. For more information, see FlexiCapture 12 Release 4 Update 9 release notes.
2

Sign in again

Sign in again in each import profile that uses the Microsoft Graph Mail API or IMAP. This one-time sign-in lets the Token Management Service refresh the tokens from then on.
If you cannot update yet, replace OAuthProviders.dll instead. Replace it on every computer that has a FlexiCapture 12 component, and in the Token Management Service folder in IIS. For the file and the steps, see Error: ERR_OAUTH_SECRET_EXPIRED - FlexiCapture 12.

Fix the refresh token expired error

Import that worked before stops with an error that contains AADSTS700082: The refresh token has expired due to inactivity. Microsoft rejects a refresh token after 90 days without use, and this limit cannot be changed. Without the Token Management Service, FlexiCapture keeps using the token from the first sign-in. Microsoft then rejects that token after 90 days, even if import runs every day. To fix the error, open the import profile properties and click Sign in… to authorize again. To keep the error from coming back, store the project on the Application Server. The Token Management Service refreshes tokens only for projects on the Application Server, in FlexiCapture 12 Release 4 Update 2 and later. For a local project, sign in again at least every 90 days.

Troubleshoot errors that do not name a cause

Some errors do not say what failed. For example, External component has thrown an exception is a general .NET message. It means that a native component, such as the OAuth component, stopped with an error.
1

Check your FlexiCapture build

If your build is earlier than Release 4 Update 9, update FlexiCapture or replace the OAuth component. For more information, see Fix the expired OAuth secret error.
2

Check the Token Management Service

On the Application Server computer, open IIS Manager. Make sure that the FlexiCapture 12 Token Management site is started. If its database connection is missing, see Reconnect the Token Management Service to the database.
3

Check network access

Make sure that the computer where the error appears can reach the Microsoft resources. For more information, see Unblock the Microsoft resources.
4

Sign in again

Open the import profile properties and click Sign in… to repeat the OAuth 2.0 authorization.
5

Collect the error details

Note the full error text and your FlexiCapture build number. If the error appears during automatic import, also turn on Processing Station logging and reproduce the error. For more information, see Processing logging.
If you cannot find the answer to your question, contact ABBYY Support. Include the error text, the build number, and any log files.