Registry / azure / azure-auth-client-alpha

azure-auth-client-alpha

JSON →
library0.0.27jsnpmunverified

A lightweight abstraction around adal.js for Azure AD authentication. Current stable version is 0.0.27. Provides a simple interface to obtain identity and access tokens, decode token claims, and retrieve user info. Supports both a real ADAL client and a dummy client for testing without Azure AD integration. Key differentiator: simplifies adal.js usage and offers a mock mode for development/testing. Release cadence is irregular.

npm install azure-auth-client-alpha
INSTALL
IMPORT
SIG · AZURE-AUTH-CLIENT-
A
azure-auth-client-alpha
azurejavascriptv0.0.27
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

AuthClient
import AuthClient from 'azure-auth-client'
import { AuthClient } from 'azure-auth-client'
Default export, not named. Use default import.
AuthClient
const AuthClient = require('azure-auth-client').default
const AuthClient = require('azure-auth-client')
CommonJS require must use .default because library is ESM with default export.
AuthClient.build
AuthClient.build(config)
new AuthClient(config)
Use static factory method 'build' instead of constructor.

Shows how to import AuthClient, build with config, get identity and access tokens, and handle results.

import AuthClient from 'azure-auth-client'; const config = { clientType: 'ADAL', clientId: 'ae33c32e-d2f2-4992-a4b2-51d03e7c8677', tenantId: 'c834c34e-bbd3-4ea1-c2c2-51daeff91aa32', domain: 'bar.com' }; const authClient = AuthClient.build(config); const identityResult = authClient.getIdentityToken(); if (identityResult.ok) { console.log('Identity token:', identityResult.token); console.log('User name:', identityResult.name); console.log('Roles:', identityResult.roles); } const accessResult = authClient.getAccessToken('foo'); if (accessResult.ok) { console.log('Access token:', accessResult.token); }
Debug
Known issues
gotchaLibrary is in alpha stage (v0.0.27). API may change without notice. Not recommended for production use.
fix
Wait for stable release or pin exact version and test thoroughly.
affects: >=0.0.0
breakingThe static factory method 'build' is required to create a client. Direct instantiation with 'new AuthClient()' will not work.
fix
Use AuthClient.build(config) instead.
affects: >=0.0.0
gotchaWhen clientType is 'DUMMY', the 'identity' field must include 'name' property, not 'displayName' as used by some other libraries.
fix
Use name, givenName, familyName in dummy identity config.
affects: >=0.0.0
deprecatedUsing tenantName is possible but not documented; prefer tenantId for consistency.
fix
Use tenantId instead of tenantName.
affects: >=0.0.0
Errors
Common errors & fixes
TypeError: AuthClient is not a constructor
Attempting to use 'new AuthClient(config)' instead of factory method.
fix
Use AuthClient.build(config) instead.
SyntaxError: Cannot use import statement outside a module
Using ESM import in a CommonJS environment without transpilation.
fix
Use require('azure-auth-client').default or add type:module to package.json.
Error: Config must contain clientId, clientType, and either tenantId or domain
Missing required config fields for ADAL clientType.
fix
Ensure config includes clientType, clientId, tenantId (or tenantName), and domain.
Error: Invalid clientType. Must be 'ADAL' or 'DUMMY'
clientType property not set to allowed values.
fix
Set clientType to 'ADAL' or 'DUMMY'.
Upgrade
Version history
0.0.27latest on npm
Audit
Dependencies
adal.jsoptionalUnderlying library for Azure AD authentication when clientType is 'ADAL'
Agent activity
48 hits · last 30 days
node
40
OpenAI (training)
2
Resources
azure-auth-client-alpha — npm install azure-auth-client-alpha · libregistry