A library for signing Kafka client connections to Amazon MSK using IAM authentication via SASL/SCRAM or OAUTHBEARER. Current stable version is 1.0.3, released in 2023 with monthly minor updates. It integrates with the AWS SDK for JavaScript v3 to fetch credentials and generates auth tokens for Kafka clients like KafkaJS. Key differentiators: native AWS IAM support without custom JAAS configs, full ESM/TypeScript support, and minimal dependencies. Compared to manual signing, it handles token refresh and credential resolution automatically. Requires Node.js 14+. Ships bundled type definitions.
npm install aws-msk-iam-sasl-signer-jsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates basic producer setup with KafkaJS and IAM OAuth bearer token provider using default credentials.
Update to latest version of aws-msk-iam-sasl-signer-js when available.
Ensure your oauthBearerProvider is called on each new connection or token expiry; KafkaJS does this automatically.
Use explicit credential provider (e.g., fromNodeProviderChain) with retries or fallback.
If you relied on tokenExpiry before, check the return value. Add type guards if using TypeScript.
Use ESM import syntax or configure your bundler to handle ESM properly. Example: import { generateAuthToken } from 'aws-msk-iam-sasl-signer-js'Set AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY environment variables, or configure a credential profile, or run on an EC2 with IAM role.
Use import() dynamic import or switch to ESM by adding type:"module" to your package.json or use .mjs extension.