Docs Menu
Docs Home
/
PHP Library Manual
/

Authentication Mechanisms

This guide describes the mechanisms you can use in the PHP library to authenticate users.

Important

Percent-Encoding

You must percent-encode a username and password before you include them in a MongoDB URI. You can use the rawurlencode() method to encode these values according to the URI syntax specified in RFC 3986. Don't percent-encode the username or password when passing them in an options array parameter to the MongoDB\Client constructor.

To learn more, see the following resources:

  • RFC 3986

  • rawurlencode in the PHP manual

The following table lists the authentication mechanisms supported by MongoDB and the MongoDB Server editions that each mechanism is compatible with. Click the name of a mechanism to learn more about how to use it with your application.

Authentication Mechanism
Atlas
Enterprise Advanced
Community

SCRAM Authentication Mechanisms

Yes

Yes

Yes

Yes

Yes

Yes

Yes

No

No

Back

Security

On this page