title: Plain text SASL authentication in gremlin-javascript
body: <p>I'm trying to connect to a Gremlin server with the JavaScript driver variant.</p>
  
  <p>Up to package version 2.7.0, this is done easily by passing options to <code>Gremlin.createClient()</code> as in <a href="https://github.com/Azure-Samples/azure-cosmos-db-graph-nodejs-getting-started" rel="nofollow noreferrer">this example</a> for Azure Cosmos DB:</p>
  
  <pre><code>const client = Gremlin.createClient(
    config.port, 
    config.endpoint, 
    { 
      "session": false, 
      "ssl": true, 
      "user": `/dbs/${config.database}/colls/${config.collection}`,
      "password": config.primaryKey
    }
  );
  </code></pre>
  
  <p>In newer versions of the package I can't get it done. The <a href="https://github.com/apache/tinkerpop/blob/master/docs/src/reference/gremlin-variants.asciidoc#gremlin-javascript" rel="nofollow noreferrer">official docs</a> suggest using <code>gremlin.driver.auth.PlainTextSaslAuthenticator</code>. However, that method seems to be not implemented in the package and returns <code>TypeError: Cannot read property 'PlainTextSaslAuthenticator' of undefined</code></p>
  
  <p>My test code (same config.js as in the working example):</p>
  
  <pre><code>const gremlin = require("gremlin");
  const config = require("./config");
  
  const Graph = gremlin.structure.Graph;
  const DriverRemoteConnection = gremlin.driver.DriverRemoteConnection;
  
  const graph = new Graph();
  
  const authenticator = new gremlin.driver.auth.PlainTextSaslAuthenticator(
    `/dbs/${config.database}/colls/${config.collection}`,
    config.primaryKey
  );
  
  const g = graph.traversal().withRemote(new DriverRemoteConnection(`ws://${config.endpoint}:${config.port}`, { authenticator });
  </code></pre>
  
  <p>Return:</p>
  
  <pre><code>C:\repos\gremlin-test\index.js:9
  const authenticator = new gremlin.driver.auth.PlainTextSaslAuthenticator(
                                            ^
  
  TypeError: Cannot read property 'PlainTextSaslAuthenticator' of undefined
      at Object.&lt;anonymous&gt; (C:\repos\gremlin-test\index.js:9:47)
      at Module._compile (module.js:652:30)
      at Object.Module._extensions..js (module.js:663:10)
      at Module.load (module.js:565:32)
      at tryModuleLoad (module.js:505:12)
      at Function.Module._load (module.js:497:3)
      at Function.Module.runMain (module.js:693:10)
      at startup (bootstrap_node.js:191:16)
      at bootstrap_node.js:612:3
  </code></pre>
  
  <p>Anyone know a solution to this?</p>