title: Node Js code to connect to kerberos autehnticated mongo server
body: <p>I am trying to connect to Mongo DB server which is Kerberos authenticated in Node JS. I have the key tab file and the krb5 file. Also teh Principal name , server url and service name. Have installed kerberos in Node JS. The below code I am using, but where do i mention to put my keytab file and KRB5 conf file.</p>
  
  <p>Code :</p>
  
  <pre><code>     var MongoClient = require('mongodb').MongoClient,
            f = require('util').format,
           assert = require('assert');
  
           var server = "kerberos.example.com";
           var principal = "drivers@KERBEROS.EXAMPLE.COM";
           var urlEncodedPrincipal = encodeURIComponent(principal);
  
           MongoClient.connect(format("mongodb://%s@%s/kerberos?authMechanism=GSSAPI&amp;gssapiServiceName=mongodb", urlEncodedPrincipal, server),  function(err, db) {
           assert.equal(null, err);
           db.close();
           test.done();
           });
  </code></pre>