{"id":18021,"library":"zoominfo-api-auth-client","title":"Zoominfo API Authentication Client","description":"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.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":null,"tags":["javascript"],"install":[{"cmd":"npm install zoominfo-api-auth-client","lang":"bash","label":"npm"},{"cmd":"yarn add zoominfo-api-auth-client","lang":"bash","label":"yarn"},{"cmd":"pnpm add zoominfo-api-auth-client","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"The library primarily uses CommonJS `require`. Direct ES module `import` might not function as expected without transpilation or specific build configurations due to its CJS-centric design.","wrong":"import authClient from 'zoominfo-api-auth-client';","symbol":"authClient","correct":"const authClient = require('zoominfo-api-auth-client');"},{"note":"Functions like `getAccessTokenViaPKI` are methods on the default exported object, not named exports. Access them via the `authClient` object.","wrong":"import { getAccessTokenViaPKI } from 'zoominfo-api-auth-client';","symbol":"getAccessTokenViaPKI","correct":"const authClient = require('zoominfo-api-auth-client');\nauthClient.getAccessTokenViaPKI('username', 'clientId', 'privateKey');"},{"note":"Similar to PKI authentication, this is a method on the `authClient` object. Direct named imports will result in a runtime error.","wrong":"import { getAccessTokenViaBasicAuth } from 'zoominfo-api-auth-client';","symbol":"getAccessTokenViaBasicAuth","correct":"const authClient = require('zoominfo-api-auth-client');\nauthClient.getAccessTokenViaBasicAuth('username', 'password');"}],"quickstart":{"code":"const authClient = require('zoominfo-api-auth-client');\n\nconst ZOOMINFO_USERNAME = process.env.ZOOMINFO_USERNAME ?? '';\nconst ZOOMINFO_CLIENT_ID = process.env.ZOOMINFO_CLIENT_ID ?? '';\nconst ZOOMINFO_PRIVATE_KEY = process.env.ZOOMINFO_PRIVATE_KEY ?? '';\n\nasync function authenticateAndGetToken() {\n  if (!ZOOMINFO_USERNAME || !ZOOMINFO_CLIENT_ID || !ZOOMINFO_PRIVATE_KEY) {\n    console.error('Missing ZoomInfo credentials in environment variables.');\n    process.exit(1);\n  }\n  try {\n    console.log('Attempting to retrieve access token via PKI...');\n    const token = await authClient.getAccessTokenViaPKI(ZOOMINFO_USERNAME, ZOOMINFO_CLIENT_ID, ZOOMINFO_PRIVATE_KEY);\n    console.log('Successfully obtained access token:');\n    console.log(token);\n    // You can now use this token for subsequent Zoominfo API calls\n    return token;\n  } catch (error) {\n    console.error('Failed to get access token:', error.message);\n    // Log detailed error or handle specific Zoominfo API error codes here\n    if (error.response && error.response.data) {\n      console.error('API Error Details:', error.response.data);\n    }\n    process.exit(1);\n  }\n}\n\nauthenticateAndGetToken();","lang":"javascript","description":"This quickstart demonstrates how to obtain an access token using the PKI authentication method, utilizing environment variables for secure credential handling and including basic error logging."},"warnings":[{"fix":"Implement a token refresh mechanism in your application logic. Store the token and its expiration time, and request a new token when it's near expiration or when an API call returns an authentication error.","message":"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.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Store credentials in environment variables (e.g., `process.env.ZOOMINFO_PRIVATE_KEY`) or use a secrets management system. Access them at runtime, as demonstrated in the quickstart example.","message":"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.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pin your dependency to the specific major version (e.g., `\"zoominfo-api-auth-client\": \"^1.0.0\"`) and carefully review release notes before upgrading to a new major version.","message":"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.","severity":"breaking","affected_versions":"<2.0.0"}],"env_vars":null,"last_verified":"2026-04-23T00:00:00.000Z","next_check":"2026-07-22T00:00:00.000Z","problems":[{"fix":"Ensure you are using `const authClient = require('zoominfo-api-auth-client');` and then accessing the function as a method: `authClient.getAccessTokenViaPKI(...)`.","cause":"Attempting to destructure `getAccessTokenViaPKI` directly from the `require` statement, or using ES module `import { getAccessTokenViaPKI } ...` when the library only exports a default object.","error":"TypeError: authClient.getAccessTokenViaPKI is not a function"},{"fix":"Double-check all authentication parameters for accuracy. Verify with Zoominfo support that your API credentials are valid and active. Ensure private key format is correct (e.g., not malformed).","cause":"Incorrect credentials (username, client ID, private key, or password) provided to the authentication functions, or the credentials have expired/been revoked.","error":"Error: Request failed with status code 401"},{"fix":"Verify your internet connectivity. Check any local or network firewall rules that might be blocking outbound connections to the Zoominfo API. If you suspect an issue with the Zoominfo service itself, check their status page.","cause":"The application could not establish a connection to the Zoominfo API authentication endpoint, likely due to network issues, firewall restrictions, or an incorrect API host configuration (though not exposed in this client).","error":"Error: connect ECONNREFUSED <IP_ADDRESS>:<PORT>"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}