Authentication

Sign in with SCRAM, X.509 certificates, LDAP, Kerberos (including Windows single sign-on), AWS IAM or OpenID Connect.

The Authentication tab of the connection dialog sets how the connection signs in. Pick a mode in Authentication Mode:; the fields below change with it.

The Authentication Mode list

Set the authentication mode

  1. Open the connection dialog (New connection, or Edit on a saved connection).
  2. Click the Authentication tab.
  3. Choose a mode in Authentication Mode: and fill in its fields (see the sections below).
  4. Click Test Connection, then Save.

Modes at a glance

ModeServer mechanismFieldsAuthentication database
Nonenonenonenone
Basic (SCRAM-SHA-256)SCRAM, negotiated with the server (SCRAM-SHA-256 when it supports it)User name, Password, Authentication DBadmin by default
Legacy (SCRAM-SHA-1)SCRAM-SHA-1User name, Password, Authentication DBadmin by default
X.509MONGODB-X509the client certificate on the SSL tab$external
Kerberos (GSSAPI)GSSAPIPrincipal, Service name, Service realm, Canonicalize host name$external
LDAP (PLAIN)PLAINUser name, Password$external
AWSMONGODB-AWSAWS access key id, AWS secret access key, AWS session token$external
MongoDB OIDCMONGODB-OIDCUser name (optional) and sign-in options$external

With None the tab warns that anyone who can reach the server can read and change its data. With Legacy it reminds you that SCRAM-SHA-1 is weaker than SCRAM-SHA-256.

For every mode other than None, two options control what the connection tree shows when the user cannot list everything:

  • Always show the authentication database of the user account
  • Always show all databases and collections defined in roles of the user account

Username and password (SCRAM)

Basic authentication

  1. Choose Basic (SCRAM-SHA-256).
  2. Enter User name: and Password:. The eye button shows or hides the password.
  3. Set Authentication DB: if the user is not defined in admin.

Leave Password: empty to be asked at each connect. Once saved, the field shows “Saved (type to replace)” and a checkbox lets you forget the saved password.

X.509 certificates

  1. On the SSL tab, tick Use SSL protocol to connect and choose a Client certificate file: (a PEM file with the certificate and its private key). See TLS/SSL.
  2. X.509 User: is filled with the certificate’s subject. Keep it unless the server expects another user name.
  3. On the Authentication tab, choose X.509. The Open the SSL tab link takes you back to the certificate.

LDAP

Choose LDAP (PLAIN) and enter the directory User name: and Password:. The authentication database is $external. LDAP needs a MongoDB server configured for LDAP (an Enterprise feature). The password travels as plain text inside the connection, so use TLS.

Kerberos (GSSAPI)

  1. Choose Kerberos (GSSAPI).
  2. Enter the Principal: (for example [email protected]).
  3. Change Service name: only if the server does not use mongodb.
  4. Set Service realm: when the server’s realm differs from the principal’s (cross-realm trust).
  5. Tick Canonicalize host name if your Kerberos setup needs the server’s canonical name.

There is no password field: Kerberos uses the ticket you already hold.

PlatformHow the ticket is found
WindowsSingle sign-on: the ticket of your Windows logon session is used (SSPI, part of Windows). Sign in to Windows with your domain account and connect; nothing else to install.
LinuxThe system Kerberos library (MIT Kerberos, libgssapi_krb5.so.2) and your ticket cache: run kinit first. The library is loaded only when Kerberos is used. The .deb and .rpm packages recommend it (libgssapi-krb5-2 / krb5-libs); if it is missing, the connection says which package to install.
macOSNot available yet (there is no macOS build).

AWS IAM

  1. Choose AWS.
  2. Either enter AWS access key id: and AWS secret access key: (plus AWS session token: for temporary credentials), or leave the key id empty to use the credentials of the environment: environment variables, the ~/.aws files, SSO or the instance role.

The secret access key is kept in the credential store like a password. The session token is saved with the connection.

The identity confirmation

When the key id is empty, the connection would sign in with this computer’s own AWS identity. A server that is neither MongoDB Atlas nor this computer could misuse that identity. So the first time such a connection opens, an AWS identity box names the servers and asks whether to use your identity with them.

  • Use My AWS Identity confirms. The answer is saved with the connection, for those servers only.
  • If the servers change later, you are asked again.
  • Scheduled tasks, the command line and agents never confirm on your behalf: an unconfirmed connection is refused there.

OpenID Connect (OIDC)

  1. Choose MongoDB OIDC.
  2. Optionally enter a User name: (sent to the identity provider as a hint).
  3. Connect. Your browser opens at the identity provider the server names; sign in there. The browser then returns to a small page served by the application on this computer, and the connection opens.
OptionUse it when
Use ID token instead of Access tokenYour identity provider does not issue JWT access tokens.
Consider target endpoint trustedThe server is neither MongoDB Atlas nor localhost and you trust it. Without it, tokens are only sent to Atlas and local servers, and the connection stops before sending anything.
Use device authorization flowYou want to sign in on another device with a code instead of a redirect to this computer.
Redirect URI:The provider expects a redirect other than the default http://localhost:27097/redirect.
Token file (workload):A workload gets its token from a file instead of a sign-in.

Tokens stay in memory only and are reused silently for new tabs on the same servers while they are valid; an expired token is renewed without the browser when the provider allows it. Turn off Cache OIDC tokens in Edit > Preferences > Behavior to sign in at every connection. OIDC needs MongoDB 7.0 or later; an older server refuses it with its own message.

Troubleshooting

MessageWhat to do
Authentication failedCheck the user name, password and Authentication DB: (the database where the user was created).
“Kerberos (GSSAPI) authentication is not available on this machine: …”Install the system Kerberos library named in the message.
A Kerberos connection fails on LinuxRun kinit and check klist; check the service name and realm.
OIDC: “the sign-in at the identity provider did not finish … and was abandoned”The browser sign-in took more than 5 minutes or was closed. Connect again.
OIDC refused before any sign-inThe server is not Atlas or local: tick Consider target endpoint trusted if you trust it.
AWS connection refused in a scheduled taskOpen it once in the application and confirm the AWS identity box.