Zoominfo API Authentication Client
raw JSON →The `zoominfo-api-auth-client` package provides an official client for authenticating with the Zoominfo API. It simplifies the process of obtaining access tokens required to interact with Zoominfo's various data services. Currently at version 1.0.1, this library offers two primary authentication flows: PKI (Public Key Infrastructure) using a client ID and private key, and basic authentication using a username and password. Unlike generic HTTP clients, it specifically handles the intricacies of Zoominfo's token generation endpoints, abstracting away the underlying OAuth 2.0 or proprietary authentication mechanisms. Its release cadence is not explicitly stated, but being at a `1.x.x` version, it's expected to be stable. Key differentiators include its direct integration with Zoominfo's specific authentication methods, reducing boilerplate for developers needing to access Zoominfo data without implementing custom authentication logic.
Common errors
error TypeError: authClient.getAccessTokenViaPKI is not a function ↓
const authClient = require('zoominfo-api-auth-client'); and then accessing the function as a method: authClient.getAccessTokenViaPKI(...). error Error: Request failed with status code 401 ↓
error Error: connect ECONNREFUSED <IP_ADDRESS>:<PORT> ↓
Warnings
gotcha The library, at version 1.0.1, does not appear to expose functionality for automatically refreshing expired access tokens. Developers must implement their own logic to detect token expiration and request a new token before making subsequent API calls. ↓
gotcha Sensitive credentials such as private keys, client IDs, usernames, and passwords should never be hardcoded in source files. They must be managed securely using environment variables, configuration services, or secret management tools. ↓
breaking This library is currently at version 1.0.1. As a new major version, future updates (e.g., 2.0.0) might introduce breaking changes to method signatures, authentication flows, or error responses. Always review release notes for new major versions. ↓
Install
npm install zoominfo-api-auth-client yarn add zoominfo-api-auth-client pnpm add zoominfo-api-auth-client Imports
- authClient wrong
import authClient from 'zoominfo-api-auth-client';correctconst authClient = require('zoominfo-api-auth-client'); - getAccessTokenViaPKI wrong
import { getAccessTokenViaPKI } from 'zoominfo-api-auth-client';correctconst authClient = require('zoominfo-api-auth-client'); authClient.getAccessTokenViaPKI('username', 'clientId', 'privateKey'); - getAccessTokenViaBasicAuth wrong
import { getAccessTokenViaBasicAuth } from 'zoominfo-api-auth-client';correctconst authClient = require('zoominfo-api-auth-client'); authClient.getAccessTokenViaBasicAuth('username', 'password');
Quickstart
const authClient = require('zoominfo-api-auth-client');
const ZOOMINFO_USERNAME = process.env.ZOOMINFO_USERNAME ?? '';
const ZOOMINFO_CLIENT_ID = process.env.ZOOMINFO_CLIENT_ID ?? '';
const ZOOMINFO_PRIVATE_KEY = process.env.ZOOMINFO_PRIVATE_KEY ?? '';
async function authenticateAndGetToken() {
if (!ZOOMINFO_USERNAME || !ZOOMINFO_CLIENT_ID || !ZOOMINFO_PRIVATE_KEY) {
console.error('Missing ZoomInfo credentials in environment variables.');
process.exit(1);
}
try {
console.log('Attempting to retrieve access token via PKI...');
const token = await authClient.getAccessTokenViaPKI(ZOOMINFO_USERNAME, ZOOMINFO_CLIENT_ID, ZOOMINFO_PRIVATE_KEY);
console.log('Successfully obtained access token:');
console.log(token);
// You can now use this token for subsequent Zoominfo API calls
return token;
} catch (error) {
console.error('Failed to get access token:', error.message);
// Log detailed error or handle specific Zoominfo API error codes here
if (error.response && error.response.data) {
console.error('API Error Details:', error.response.data);
}
process.exit(1);
}
}
authenticateAndGetToken();