Skip to content

Commit 73e4a2c

Browse files
committed
Fix for scram handling
1 parent e2b832d commit 73e4a2c

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

lib/db.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1028,9 +1028,13 @@ var Db = function(databaseName, topology, options) {
10281028

10291029
// If classic auth delegate to auth command
10301030
if(authMechanism == 'MONGODB-CR') {
1031-
topology.auth('mongocr', authdb, username, password, function(err, result) {
1032-
if(err) return handleCallback(callback, err, false);
1033-
_callback(null, true);
1031+
topology.auth('scram-sha-1', authdb, username, password, function(err, result) {
1032+
if(err == null && result == true) return _callback(null, true);
1033+
1034+
topology.auth('mongocr', authdb, username, password, function(err, result) {
1035+
if(err) return handleCallback(callback, err, false);
1036+
_callback(null, true);
1037+
});
10341038
});
10351039
} else if(authMechanism == 'PLAIN') {
10361040
topology.auth('plain', authdb, username, password, function(err, result) {

0 commit comments

Comments
 (0)