Skip to content

mongodb-js/oidc-plugin

Repository files navigation

@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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages