Github user jorgebay commented on a diff in the pull request: https://github.com/apache/tinkerpop/pull/889#discussion_r201601044 --- Diff: gremlin-javascript/src/main/javascript/gremlin-javascript/lib/driver/driver-remote-connection.js --- @@ -151,7 +156,16 @@ class DriverRemoteConnection extends RemoteConnection { return; } - if (response.status.code >= 400) { + if (response.status.code === responseStatusCode.authenticationChallenge && this._authenticator) { + this._authenticator.evaluateChallenge(response).then(res => { --- End diff -- We should have a way to build a request (in this case an auth request) and send it providing an existing `requestId`, that doesn't add a key to the `this._responseHandlers`. That way the whole flow uses the same `requestId` and the response handler w/ the original callback is maintained until the response message (out of the auth flow) for the original request is obtained.
---