{"id":27602,"library":"azure-auth-client-alpha","title":"azure-auth-client","description":"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.","status":"active","version":"0.0.27","language":"javascript","source_language":"en","source_url":"https://github.com/mike706574/azure-auth-client-js","tags":["javascript"],"install":[{"cmd":"npm install azure-auth-client-alpha","lang":"bash","label":"npm"},{"cmd":"yarn add azure-auth-client-alpha","lang":"bash","label":"yarn"},{"cmd":"pnpm add azure-auth-client-alpha","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Underlying library for Azure AD authentication when clientType is 'ADAL'","package":"adal.js","optional":true}],"imports":[{"note":"Default export, not named. Use default import.","wrong":"import { AuthClient } from 'azure-auth-client'","symbol":"AuthClient","correct":"import AuthClient from 'azure-auth-client'"},{"note":"CommonJS require must use .default because library is ESM with default export.","wrong":"const AuthClient = require('azure-auth-client')","symbol":"AuthClient","correct":"const AuthClient = require('azure-auth-client').default"},{"note":"Use static factory method 'build' instead of constructor.","wrong":"new AuthClient(config)","symbol":"AuthClient.build","correct":"AuthClient.build(config)"}],"quickstart":{"code":"import AuthClient from 'azure-auth-client';\n\nconst config = {\n  clientType: 'ADAL',\n  clientId: 'ae33c32e-d2f2-4992-a4b2-51d03e7c8677',\n  tenantId: 'c834c34e-bbd3-4ea1-c2c2-51daeff91aa32',\n  domain: 'bar.com'\n};\n\nconst authClient = AuthClient.build(config);\n\nconst identityResult = authClient.getIdentityToken();\nif (identityResult.ok) {\n  console.log('Identity token:', identityResult.token);\n  console.log('User name:', identityResult.name);\n  console.log('Roles:', identityResult.roles);\n}\n\nconst accessResult = authClient.getAccessToken('foo');\nif (accessResult.ok) {\n  console.log('Access token:', accessResult.token);\n}","lang":"javascript","description":"Shows how to import AuthClient, build with config, get identity and access tokens, and handle results."},"warnings":[{"fix":"Wait for stable release or pin exact version and test thoroughly.","message":"Library is in alpha stage (v0.0.27). API may change without notice. Not recommended for production use.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use AuthClient.build(config) instead.","message":"The static factory method 'build' is required to create a client. Direct instantiation with 'new AuthClient()' will not work.","severity":"breaking","affected_versions":">=0.0.0"},{"fix":"Use name, givenName, familyName in dummy identity config.","message":"When clientType is 'DUMMY', the 'identity' field must include 'name' property, not 'displayName' as used by some other libraries.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Use tenantId instead of tenantName.","message":"Using tenantName is possible but not documented; prefer tenantId for consistency.","severity":"deprecated","affected_versions":">=0.0.0"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Use AuthClient.build(config) instead.","cause":"Attempting to use 'new AuthClient(config)' instead of factory method.","error":"TypeError: AuthClient is not a constructor"},{"fix":"Use require('azure-auth-client').default or add type:module to package.json.","cause":"Using ESM import in a CommonJS environment without transpilation.","error":"SyntaxError: Cannot use import statement outside a module"},{"fix":"Ensure config includes clientType, clientId, tenantId (or tenantName), and domain.","cause":"Missing required config fields for ADAL clientType.","error":"Error: Config must contain clientId, clientType, and either tenantId or domain"},{"fix":"Set clientType to 'ADAL' or 'DUMMY'.","cause":"clientType property not set to allowed values.","error":"Error: Invalid clientType. Must be 'ADAL' or 'DUMMY'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}