Kamva/mgm

Authentication Failure

adimyth opened this issue · 0 comments

Describe the bug
Authentication error when trying to connect to Mongo. I get the following error when trying to connect to mongo using user credentials -

{
    "error": "connection() error occured during connection handshake: auth error: sasl conversation error: unable to authenticate using mechanism \"SCRAM-SHA-1\": (AuthenticationFailed) Authentication failed.",
    "ok": false
}

I am able to login via mongo-shell using the same creds as in the screenshot below. However the ORM throws error -

Screenshot 2022-02-26 at 6 45 08 PM

Note: This is similar to this closed issue.

To Reproduce
Steps to reproduce the behavior:

  1. Create a test user with the following creds -
    MONGODB_PORT="27017"
    MONGODB_URL="localhost"
    MONGODB_USERNAME="test"
    MONGODB_PASSWORD="test123"
    MONGODB_DB="todos"
  2. Connect to mongo using the ODM
    package main
    
    import (
    	"log"
    
    	"github.com/Kamva/mgm/v2"
    	"go.mongodb.org/mongo-driver/mongo/options"
    )
    
    func init() {
    	err = mgm.SetDefaultConfig(nil, "todos", options.Client().ApplyURI("mongodb://test:test123@localhost:27017"))
    	if err != nil {
    		log.Fatal("Error setting default config")
    		log.Fatal(err)
    	}
    }

Expected behavior
Connection should not fail when trying to connect via above piece of code

Screenshots
If applicable, add screenshots to help explain your problem.

Environment (please complete the following information):

  • OS: MacOS Big Sur
  • Mongo: v5.0.6

Additional context
Add any other context about the problem here.