The `brightspace-auth-provisioning` library facilitates the creation and assertion of access tokens against a Brightspace authentication service. It abstracts the complexities of token generation, allowing developers to provision tokens with specific claims such as scopes, tenant IDs, user IDs, impersonator IDs, and Caliper FSIDs. The current stable version is `9.0.1`, which requires Node.js version `20.x` or higher. The package sees active development with major versions released periodically (e.g., v7, v8, v9) and more frequent patch and minor releases. Its key differentiator is its tight integration with the Brightspace authentication ecosystem, providing a specific API for generating tokens that adhere to Brightspace's assertion requirements, including a flexible `keyLookup` mechanism for signing keys and support for caching mechanisms.
npm install brightspace-auth-provisioningVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to instantiate `AuthTokenProvisioner`, provide a `keyLookup` function returning a `KeyObject`, and then use it to provision an access token with specified claims.
Upgrade your Node.js environment to version 20.x or newer. Use `nvm install 20 && nvm use 20` or similar version management tools.
Ensure that your `keyLookup` function correctly loads and returns a `KeyObject` (e.g., from a PEM string using `crypto.createPrivateKey`).
Review the specific release notes or changelog for the version you are upgrading to and adapt your code accordingly. Pay close attention to constructor options and method signatures.
Install the peer dependency: `npm install brightspace-auth-keys` or `yarn add brightspace-auth-keys`.
For CommonJS, use `const { AuthTokenProvisioner } = require('brightspace-auth-provisioning');`. For ES Modules, use `import { AuthTokenProvisioner } from 'brightspace-auth-provisioning';`.Ensure that the `key` property in the object returned by `keyLookup` is a properly instantiated `KeyObject`. Use `crypto.createPrivateKey()` to convert PEM strings or other formats.