@@ -281,12 +281,38 @@ mechanism:
281281
282282 .. include:: /includes/fundamentals/code-snippets/auth-credentials-aws.rst
283283
284- If you need to specify an AWS session token, use the
285- :java-docs:`applyConnectionString() </apidocs/mongodb-driver-core/com/mongodb/MongoClientSettings.Builder.html#applyConnectionString(com.mongodb.ConnectionString)>`
286- method to specify a connection string that specifies the
287- ``authMechanism`` and ``AWS_SESSION_TOKEN`` parameter values.
284+ If you need to specify an AWS session token, you can add it using
285+ one of the following choices:
288286
289- .. include:: /includes/fundamentals/code-snippets/auth-credentials-aws-session.rst
287+ - **Specify your AWS session token in a connection string.**
288+
289+ If you prefer to pass the AWS session token in the connection string
290+ alongside your MongoCredential specify your authentication mechanism
291+ in the ``authMechanism`` parameter and your session token in the
292+ ``authMechanismProperties`` parameter. Then, add it to your
293+ ``MongoClientSettings`` by calling the
294+ :java-docs:`applyConnectionString() </apidocs/mongodb-driver-core/com/mongodb/MongoClientSettings.Builder.html#applyConnectionString(com.mongodb.ConnectionString)>`
295+ method as follows:
296+
297+ .. include:: /includes/fundamentals/code-snippets/auth-credentials-aws-session.rst
298+
299+ - **Specify your AWS session token in a MongoCredential.**
300+
301+ You can include your AWS session token in your ``MongoCredential``
302+ instance by specifying it in a call to the
303+ :java-docs:`withMechanismProperty() </apidocs/mongodb-driver-core/com/mongodb/MongoCredential.html#withMechanismProperty(java.lang.String,T)>`
304+ method as shown below:
305+
306+ .. code-block:: java
307+
308+ MongoCredential.createAwsCredential("<username>", "<password>".toCharArray()) .withMechanismProperty("AWS_SESSION_TOKEN", "<awsSessionToken>");
309+
310+ - **Specify your AWS session token in an environment variable.**
311+
312+ In your client execution environment, set an environment variable
313+ called ``AWS_SESSION_TOKEN`` and assign your token to it. The value is
314+ automatically picked up by your MongoClient when you specify the
315+ ``MONGODB-AWS`` authentication mechanism.
290316
291317.. _x509-auth-mechanism:
292318
0 commit comments