@mongodb-js/oidc-plugin
v1.1.4
Published
MongoDB OIDC plugin for the Node.js driver
Downloads
194,171
Maintainers
Keywords
Readme
@mongodb-js/oidc-plugin
A plugin for the MongoDB Node.js driver to support human/browser-based OIDC authentication flows.
OIDC support is a preview feature of MongoDB and not currently recommended for production usage.
Example usage
import { MongoClient } from 'mongodb';
import { createMongoDBOIDCPlugin } from '@mongodb-js/oidc-plugin';
// All config options are optional.
const config = {
openBrowser: {
command: 'open -a "Firefox"',
},
// allowedFlows: ['auth-code', 'device-auth'], // if Device Auth Grant flow is required
};
const client = await MongoClient.connect(
'mongodb+srv://.../?authMechanism=MONGODB-OIDC',
{
...createMongoDBOIDCPlugin(config).mongoClientOptions,
}
);
// ...
See the TypeScript annotations for more API details.