Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Auth fails with mongodb atlas cluster #22

Closed
itzmanish opened this issue Aug 16, 2020 · 5 comments
Closed

Auth fails with mongodb atlas cluster #22

itzmanish opened this issue Aug 16, 2020 · 5 comments
Assignees

Comments

@itzmanish
Copy link

Describe the bug
"connection() : auth error: sasl conversation error: unable to authenticate using mechanism "SCRAM-SHA-1": (AtlasError) Authentication failed.

Everything was working fine till today I get error with authentication failed. I didn't changed anything, not a single line of code but still I get error on any operation with mgm connection() : auth error: sasl conversation error: unable to authenticate using mechanism \"SCRAM-SHA-1\": (AtlasError) Authentication failed.

To Reproduce
Steps to reproduce the behavior:
1.

err = mgm.SetDefaultConfig(nil, "directory", options.Client().ApplyURI(os.Getenv("MONGODB_URI")))
if err != nil {
	log.Fatal(err)
}
  1. Export MONGODB_URI with mongodb atlas cluster uri.
  2. Run the server.
  3. Do Some operation.

Expected behavior
Operation should complete without any error.

Environment (please complete the following information):

  • OS: Ubuntu 20.04
@mehran-prs
Copy link
Member

mehran-prs commented Aug 17, 2020

Hi @itzmanish

Please check you authentication data by login manually to you DB, I think this is because of wrong AuthenticationDatabase or username|password in your DB URI.
Maybe you enabled authentication recently in your Atlas cluster and you should check your DB authentication data.

@itzmanish
Copy link
Author

itzmanish commented Aug 17, 2020

Please check you authentication data by login manually to you DB, I think this is because of wrong AuthenticationDatabase or username|password in your DB URI.

Not the case. I was using for a long time with same setup.

However something weird I have seen that official mongo driver gives me same error but when I pass credential option with username and password it works. Don't know why this issue didn't occur before.

@mehran-prs
Copy link
Member

Print your URI before connection, maybe it's not what you expected.
I'll close this issue, but if you need some help, comment here.

@itzmanish
Copy link
Author

URI is fine. I don't know why I need to use credential option since I have username and password in URI string.

@mehran-prs
Copy link
Member

Just like this?
mongodb://{username}:{password}@{your host}:27017/{yourdb}?authSource={admin or your authentication database}

use command line command (like mongo "mongodb://test:testpwd@localhost/test?authSource=admin") and check it, because I think just URI can cause this error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants