Itgenobr166 The OAuth flow redirected to the correct host, but no access token was present

Wanneer ik via een batchbestand probeer een query uit te voeren krijg ik de melding:

itgenobr166
The OAuth flow redirected to the correct host, but no access token was present in the URL after all redirects

Waar kan dit in zitten?

Stack trace:

2022-07-22 09:59:08.400 Error itgenobr166: Invantive.Basics.InvantiveSqlException
ValidationException
   at Invantive.Basics.ValidationException..ctor(GlobalState owner, ExecutionOptions executionOptions, String messageCode, String errorMessage, String kindRequest, String localStackTrace, String nk, Exception innerException, Boolean inheritMessageCodeWhenPresent, Nullable`1 uid, Boolean isRecoverable, String poolIdentityId, String url)
   at Invantive.Basics.InvantiveSqlException..ctor(GlobalState owner, ExecutionOptions executionOptions, String validationCode, String errorMessage, String kindRequest, String stackTrace, String nk, Exception innerException, Boolean inheritMessageCodeWhenPresent, Nullable`1 uid, Boolean isRecoverable, String poolIdentityId)
   at Invantive.Data.OAuth.OAuthBackgroundProvider.GetOAuthAccessTokenForEOL(GlobalState owner, ExecutionOptions executionOptions, String providerName, OAuthInformation oauthInfo, Credentials credentials)
   at Invantive.Data.OAuth.OAuthBackgroundProvider.Invantive.Data.IOAuthProvider.GetOAuthToken(GlobalState owner, ExecutionOptions executionOptions, SerializableDatabase database, DataContainer dataContainer, OAuthInformation oauthInfo, Credentials credentials)
   at Invantive.Data.ConnectionManager.HG(GlobalState , ExecutionOptions , SerializableDatabase , DataContainer , OAuthInformation , Credentials )
   at Invantive.Data.ConnectionManager.OG(GlobalState , ExecutionOptions , SerializableDatabase , DataContainer , OAuthInformation , Credentials )
   at Invantive.Data.ConnectionManager.GetOAuthTokenForConnection(GlobalState owner, ExecutionOptions executionOptions, SerializableDatabase database, DataContainer dataContainer, ISupportsOAuth provider, Credentials credentials, Boolean ignoreDecryptionErrors, Boolean& decryptionErrorsOccurred)
   at Invantive.Data.ConnectionManager.PG(GlobalState , ExecutionOptions , IConnectionDataProvider , SerializableDatabase , DataContainer , Credentials , Boolean , Boolean& )
   at Invantive.Data.ConnectionManager.OpenDataContainerProvider(GlobalState owner, ExecutionOptions executionOptions, SerializableDatabase database, DataContainer dataContainer, Credentials credentials, List`1 triedProviders, Boolean ignoreDecryptionErrors, Boolean& decryptionErrorsOccurred)
   at Invantive.Data.ConnectionManager.LG(GlobalState , ExecutionOptions , CredentialsContainer , Boolean , Boolean& )
   at Invantive.Data.ConnectionManager.Open(GlobalState owner, ExecutionOptions executionOptions, CredentialsContainer credentialsContainer, Boolean ignoreDecryptionErrors, Boolean& decryptionErrorsOccurred)
   at Invantive.Producer.UtilityBaseCore.OpenDatabase(GlobalState owner, ExecutionOptions executionOptions, String databaseFullName, CredentialsContainer credentialsContainer, Boolean ignoreDecryptionErrors, Boolean& decryptionErrorsOccurred)
   at Invantive.Producer.UtilityBaseCore.CheckConnection(GlobalState owner, ExecutionOptions executionOptions, Boolean forceReconnect, Boolean silent, String databaseName, CredentialsContainer credentialsContainer)
   at IDH.D.B(String[] )
   at Invantive.Producer.QueryEngine.Program.Main(String[] arguments)
   at Invantive.Data.OAuth.OAuthBackgroundProvider.GetOAuthAccessTokenForEOL(GlobalState owner, ExecutionOptions executionOptions, String providerName, OAuthInformation oauthInfo, Credentials credentials)
   at Invantive.Data.OAuth.OAuthBackgroundProvider.Invantive.Data.IOAuthProvider.GetOAuthToken(GlobalState owner, ExecutionOptions executionOptions, SerializableDatabase database, DataContainer dataContainer, OAuthInformation oauthInfo, Credentials credentials)
   at Invantive.Data.ConnectionManager.HG(GlobalState , ExecutionOptions , SerializableDatabase , DataContainer , OAuthInformation , Credentials )
   at Invantive.Data.ConnectionManager.OG(GlobalState , ExecutionOptions , SerializableDatabase , DataContainer , OAuthInformation , Credentials )
   at Invantive.Data.ConnectionManager.GetOAuthTokenForConnection(GlobalState owner, ExecutionOptions executionOptions, SerializableDatabase database, DataContainer dataContainer, ISupportsOAuth provider, Credentials credentials, Boolean ignoreDecryptionErrors, Boolean& decryptionErrorsOccurred)
   at Invantive.Data.ConnectionManager.PG(GlobalState , ExecutionOptions , IConnectionDataProvider , SerializableDatabase , DataContainer , Credentials , Boolean , Boolean& )
   at Invantive.Data.ConnectionManager.OpenDataContainerProvider(GlobalState owner, ExecutionOptions executionOptions, SerializableDatabase database, DataContainer dataContainer, Credentials credentials, List`1 triedProviders, Boolean ignoreDecryptionErrors, Boolean& decryptionErrorsOccurred)
   at Invantive.Data.ConnectionManager.LG(GlobalState , ExecutionOptions , CredentialsContainer , Boolean , Boolean& )
   at Invantive.Data.ConnectionManager.Open(GlobalState owner, ExecutionOptions executionOptions, CredentialsContainer credentialsContainer, Boolean ignoreDecryptionErrors, Boolean& decryptionErrorsOccurred)
   at Invantive.Producer.UtilityBaseCore.OpenDatabase(GlobalState owner, ExecutionOptions executionOptions, String databaseFullName, CredentialsContainer credentialsContainer, Boolean ignoreDecryptionErrors, Boolean& decryptionErrorsOccurred)
2022-07-22 09:59:08.459 Error itgencun016: Error itgendhb005: Could not connect to database 'ACME\acme'. Application will be closed.
2022-07-22 09:59:08.464 Error itgendhb005: ValidationException
   at Invantive.Basics.ValidationException..ctor(GlobalState owner, ExecutionOptions executionOptions, String messageCode, String errorMessage, String kindRequest, String localStackTrace, String nk, Exception innerException, Boolean inheritMessageCodeWhenPresent, Nullable`1 uid, Boolean isRecoverable, String poolIdentityId, String url)
   at IDH.D.B(String[] )
   at Invantive.Producer.QueryEngine.Program.Main(String[] arguments)
   at IDH.D.B(String[] )
2022-07-22 09:59:08.487 Error itgenube182: itgendhb005: Could not connect to database 'ACME\acme'. Application will be closed.

Welke release van Invantive Data Hub betreft dit?

Het gaat om Exact Online?

Excuses voor de incompleetheid.
Het gaat inderdaad om Exact Online en om Data Hub 22.0.223-PROD+3432

De foutcode itgenobr166 (samen met zusjes itgenobr240, itgenobr241, itgenobr242, itgenobr243, itgenobr244, itgenobr245 en itgenobr246) geeft aan dat Exact Online bij het doorsturen van de interne browser van Invantive Data Hub uiteindelijk geen “access token” (tijdelijk wachtwoord) kon doorgeven.

Controleer of een redirect URL opgegeven is in settings*.xml of het aanmeldscherm die de waarde van access tokens die Exact Online teruggeeft niet “opeet”, bijvoorbeeld door een doorverwijzing (“redirect”, HTTP 301 of HTTP 302).

In het algemeen raden we bij gebruik van een andere dan door Invantive aangeleverde redirect URL het sterk af om een bestaande website hiervoor te gebruiken. Het beste is om een losse website met één pagina in het leven te roepen met een eigen HTTPS-certificaat en zonder enige vorm van applicatielogica. Een dergelijke website kan bijvoorbeeld op AWS S3 en AWS Cloudfront gebaseerd zijn met een enkele index.html-pagina.

Ongeschikte Redirect URL

Een voorbeeld van een URL die ongeschikt is als redirect URL voor Exact Online omdat hij access tokens opeet is:

https://cloud.invantive.com/?code=accesstokenwaarde

Na de redirect van deze user interface van Invantive Cloud verdwijnt de waarde van code (bewust). Dit is eenvoudig te controleren door deze URL in de eigen browser te openen.

Geschikte Redirect URL

Een voorbeeld van een URL die geschikt is als redirect URL voor Exact Online omdat hij de access token in stand houdt is:

https://exactonlineclientredirect.invantive.com/?code=accesstokenwaarde

Ook dit is eenvoudig te controleren in de browser door de URL te openen. De uiteindelijke URL in de browser is https://exactonlineclientredirect.invantive.com/?code=accesstokenwaarde.

Bedankt voor de reactie.
Ik heb omgebouwd naar exactonlineclientredirect.invantive.com en dat werkt inderdaad. Ik gebruikten een willekeurige interne host (waar wel een website achter draait).

Ik zie niet waarom het uitmaakt waar het redirect URL naartoe verwijst, maar het werkt nu, dus we laten het zo.

Fijn dat het werkt! Waarschijnlijk eet de interne site de tokens en andere GET-parameters en/of fragments op, en voldoet daarmee niet aan de specificaties voor een redirect URL volgens de OAuth2 specificatie. Meer informatie over de verwachte werking van de redirect URL is te vinden in bijvoorbeeld 4.1C van RFC 6749 - The OAuth 2.0 Authorization Framework.

Sorry for necro-posting, but I’m having the same problem. I’m seeing this even on small apps I build myself. I contacted Exact Online about this. Will post the results here for anyone who Googles to this thread.

Het wordt aanbevolen om een URL te gebruiken als Redirect URL die niet zelf weer redirect naar een andere pagina via een HTTP 301, HTTP 302 of javascript redirect. Meestal verdwijnt het access token bij de redirect. Dit is meestal te vervolgen door te Chrome te starten, Development modus in te schakelen (F12), Caching uit te schakelen, de URL te openen inclusief een access token als #code=xxx in de URL en te kijken welke URL’s er onder de “Netwerk”-tab verschijnen.

Een voorbeeld van een correct opgezette URL als Redirect URL is clientredirect.invantive.com.