{"name":"@azure/identity","version":"1.1.0-preview1","keywords":["azure","active directory","authentication","credential","certificate","managed service identity","client secret","access token"],"author":{"name":"Microsoft Corporation"},"license":"MIT","_id":"@azure/identity@1.1.0-preview1","maintainers":[{"name":"azure-sdk","email":"azure-sdk-npmjs@microsoft.com"}],"homepage":"https://github.com/azure/azure-sdk-for-js/tree/master/sdk/identity/identity","bugs":{"url":"https://github.com/azure/azure-sdk-for-js/issues"},"dist":{"shasum":"0e0d67125af7535cdc534933636af97f5b4b043c","tarball":"http://registry-npm.ywwl.com/@azure/identity/download/@azure/identity-1.1.0-preview1.tgz","fileCount":84,"integrity":"sha512-8IYH4kWHXCqn1t5VIQmg5FugVoUoTK4rKI7/liJFpNRWdcuzLjNQe+qy9UinQxfXsjwx8H0zjW5yC/l2QNDb1Q==","signatures":[{"sig":"MEYCIQDsEnhJX7/PqANejsbJCLZH8N/5iXkjoOCQfWjvdUFYpgIhAN7nCjBo0xFTxbt/4Fo632DazCJRiyeyFgdkEBs5qeNa","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":422823,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJeaBmlCRA9TVsSAnZWagAATpsP/RDNZO77UcsPfVv6BgAV\no1dD0OHDobPU1Ifyu0kkHwEzuoaAMkHizejB4R1uhw+3SJrx/12MTI23E4Oo\nNKCTOA3gPnJfRsi2/avWVbgSwOJBjx7CJosPGoTJzx7MBIDwYmnTfeF/rKUK\nHeZR5p9anrZiDQ9i63vuHmdNOk981uilGcQLsvEwR7RbmbAuVF9JS+zifvTY\nw18FcEJgpc6bkZdSz5gmKR1GA2B5/M3hSYD8Kb4klFgGA7es3ZQa2YMcCysU\nzL28o8aLtThbaYcr689VTAjiWXaU+N06BbxhcB1WjKs8BXvUn8aeevSw1TdW\n0Xdv79Gm61WQnUSV8qPvXzrjPN7wwyH16kanZh0ceuIuIToV9pVb9gj/JiIi\naumb7UPDEIdH8GZZOoYVolAchXzG5cxvVQhtVXLIr5VSlrEP99MAvQxAnmVr\nJfGm7/MDtj4XPwAFiN/kkycKXw8kuuZs1/WD+qKRFHa1946XqdZuz3xMfDqo\n+60hbDwhcmFKZpAPfQCwxijylF1FRBMSozJLdNEelLKrHeOdaP3Wg0QKkqdv\nZQCDj01m5vuDfLAzfsY1hSTrdjA1b4lPqJFSK2Vufy8eNX4vRBFd72H0mGQh\nDRtADa8KckzfugR40tTQGmYxv+2EChW0MNdKitstRpIXkMr/1WOmaa8gqgUk\nl0//\r\n=oEnT\r\n-----END PGP SIGNATURE-----\r\n","size":73996,"noattachment":false,"key":"/@azure/identity/-/@azure/identity-1.1.0-preview1.tgz"},"main":"dist/index.js","_from":"file:/home/vsts/work/1/packages/azure-identity-1.1.0-preview1.tgz","types":"./types/identity.d.ts","engine":{"node":">=8.0.0"},"module":"dist-esm/src/index.js","readme":"## Azure Identity client library for JavaScript\n\nThis library simplifies authentication against Azure Active Directory for Azure SDK libraries.\nIt provides a set of `TokenCredential` implementations which can be passed into SDK libraries\nto authenticate API requests. It supports token authentication using an Azure Active Directory [service principal](https://docs.microsoft.com/en-us/cli/azure/create-an-azure-service-principal-azure-cli) or [managed identity](https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/overview).\n\n## Getting started\n\n### Prerequisites\n\n- an Azure subscription\n  - if you don't have one, you can sign up for a [free account](https://azure.microsoft.com/free/)\n- Node.js 8 LTS or higher\n\n### Install the package\n\nInstall Azure Identity with `npm`:\n\n```sh\nnpm install --save @azure/identity\n```\n\n## Key concepts\n\nIf this is your first time using `@azure/identity` or the Microsoft identity platform (Azure Active Directory), we recommend that you read [Using `@azure/identity` with Microsoft Identity Platform](/documentation/using-azure-identity.md) first. This document will give you a deeper understanding of the platform and how to configure your Azure account correctly.\n\n### Credentials\n\nAzure Identity offers a variety of credential classes that are accepted by Azure SDK data plane clients. Each client library documents its Azure Identity integration in its README and samples. Azure SDK management plane libraries (those starting with `@azure/arm-*`) do not accept these credentials.\n\nCredentials differ mostly in configuration:\n\n| credential class                    | identity                              | configuration                                                                                    |\n| ----------------------------------- | ------------------------------------- | ------------------------------------------------------------------------------------------------ |\n| [`DefaultAzureCredential`][1]       | service principal or managed identity | none for managed identity; [environment variables](#environment-variables) for service principal |\n| [`ManagedIdentityCredential`][2]    | managed identity                      | none                                                                                             |\n| [`EnvironmentCredential`][3]        | service principal                     | [environment variables](#environment-variables)                                                  |\n| [`ClientSecretCredential`][4]       | service principal                     | constructor parameters                                                                           |\n| [`ClientCertificateCredential`][5]  | service principal                     | constructor parameters                                                                           |\n| [`DeviceCodeCredential`][6]         | app registration details              | constructor parameters                                                                           |\n| [`AuthorizationCodeCredential`][7]  | app registration details              | constructor parameters                                                                           |\n| [`InteractiveBrowserCredential`][8] | app registration details              | constructor parameters                                                                           |\n| [`UsernamePasswordCredential`][9]   | user principal                        | constructor parameters                                                                           |\n\nCredentials can be chained and tried in turn until one succeeds; see [chaining credentials](#chaining-credentials) for details.\n\n### DefaultAzureCredential\n\n`DefaultAzureCredential` is appropriate for most scenarios. It supports authenticating as a service principal or managed identity. To authenticate as a service principal, provide configuration in environment variables as described in the next section. Currently this credential attempts to use the `EnvironmentCredential` and `ManagedIdentityCredential`, in that order.\n\nAuthenticating as a managed identity requires no configuration, but does require platform support. See the [managed identity documentation](https://docs.microsoft.com/en-us/azure/active-directory/managed-identities-azure-resources/services-support-managed-identities) for more information.\n\n### Environment variables\n\n`DefaultAzureCredential` and `EnvironmentCredential` are configured for service principal authentication with these environment variables:\n\n| variable name                   | value                                                                                 |\n| ------------------------------- | ------------------------------------------------------------------------------------- |\n| `AZURE_CLIENT_ID`               | service principal's app id                                                            |\n| `AZURE_TENANT_ID`               | id of the principal's Azure Active Directory tenant                                   |\n| `AZURE_CLIENT_SECRET`           | one of the service principal's client secrets (implies `ClientSecretCredential`)      |\n| `AZURE_CLIENT_CERTIFICATE_PATH` | one of the service principal's client secrets (implies `ClientCertificateCredential`) |\n| `AZURE_USERNAME`                | the username of a user in the tenant (implies `UsernamePasswordCredential`)           |\n| `AZURE_PASSWORD`                | the password of the user specified in `AZURE_USERNAME`                                |\n\n## Examples\n\n### `DefaultAzureCredential`\n\n```javascript\n// The default credential first checks environment variables for configuration as described above.\n// If environment configuration is incomplete, it will try managed identity.\nconst { KeyClient } = require(\"@azure/keyvault-keys\");\nconst { DefaultAzureCredential } = require(\"@azure/identity\");\n\n// Azure SDK clients accept the credential as a parameter\nconst credential = new DefaultAzureCredential();\nconst client = new KeyClient(vaultUrl, credential);\nconst getResult = await client.getKey(\"MyKeyName\");\n```\n\n### Authenticating as a service principal\n\n```javascript\n// Using a client secret\nconst { ClientSecretCredential } = require(\"@azure/identity\");\nconst credential = new ClientSecretCredential(tenantId, clientId, clientSecret);\n\n// Using a PEM-encoded certificate with a private key, not password protected\nconst { ClientCertificateCredential } = require(\"@azure/identity\");\nconst credential = new ClientCertificateCredential(\n  tenantId,\n  clientId,\n  \"/app/certs/certificate.pem\"\n);\n\n// Using environment variables (see \"Environment variables\" above for variable names)\nconst { EnvironmentCredential } = require(\"@azure/identity\");\nconst credential = new EnvironmentCredential();\n```\n\n### Using the `AuthorizationCodeCredential`\n\nThe `AuthorizationCodeCredential` takes more up-front work to use than the other credential types at this time. A full sample demonstrating how to use this credential can be found in [`samples/authorizationCodeSample.ts`](https://github.com/Azure/azure-sdk-for-js/tree/00c61a04b0ffec18be0247588a1cf6e63bb639c6/sdk/identity/identity/samples/authorizationCodeSample.ts).\n\n### Chaining credentials\n\n```javascript\nconst { ClientSecretCredential, ChainedTokenCredential } = require(\"@azure/identity\");\n\n// When an access token is requested, the chain will try each\n// credential in order, stopping when one provides a token\nconst firstCredential = new ClientSecretCredential(tenantId, clientId, clientSecret);\nconst secondCredential = new ClientSecretCredential(tenantId, anotherClientId, anotherSecret);\nconst credentialChain = new ChainedTokenCredential(firstCredential, secondCredential);\n\n// The chain can be used anywhere a credential is required\nconst { KeysClient } = require(\"@azure/keyvault-keys\");\nconst client = new KeysClient(vaultUrl, credentialChain);\n```\n\n## Troubleshooting\n\n### General\n\nCredentials raise `AuthenticationError` when they fail to authenticate. This class has a `message` field which describes why authentication failed. An `AggregateAuthenticationError` will be raised by `ChainedTokenCredential` with an `errors` field containing an array of errors from each credential in the chain.\n\n## Next steps\n\n### Read the documentation\n\nAPI documentation for this library can be found on our [documentation site](https://docs.microsoft.com/javascript/api/@azure/identity).\n\n### Provide Feedback\n\nIf you encounter bugs or have suggestions, please [open an issue](https://github.com/Azure/azure-sdk-for-js/issues).\n\n## Contributing\n\nThis project welcomes contributions and suggestions. Most contributions require you to agree to a\nContributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us\nthe rights to use your contribution. For details, visit [https://cla.microsoft.com](https://cla.microsoft.com).\n\nWhen you submit a pull request, a CLA-bot will automatically determine whether you need to provide\na CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions\nprovided by the bot. You will only need to do this once across all repos using our CLA.\n\nIf you'd like to contribute to this library, please read the [contributing guide](https://github.com/Azure/azure-sdk-for-js/tree/00c61a04b0ffec18be0247588a1cf6e63bb639c6/CONTRIBUTING.md) to learn more about how to build and test the code.\n\nThis project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).\nFor more information, see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)\nor contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.\n\n[1]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/defaultazurecredential.html\n[2]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/managedidentitycredential.html\n[3]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/environmentcredential.html\n[4]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/clientsecretcredential.html\n[5]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/clientcertificatecredential.html\n[6]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/devicecodecredential.html\n[7]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/authorizationcodecredential.html\n[8]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/interactivebrowsercredential.html\n[9]: https://azuresdkdocs.blob.core.windows.net/$web/javascript/azure-identity/1.0.0/classes/usernamepasswordcredential.html\n\n\n![Impressions](https://azure-sdk-impressions.azurewebsites.net/api/impressions/azure-sdk-for-js%2Fsdk%2Fidentity%2Fidentity%2FREADME.png)\n","browser":{"stream":"./node_modules/stream-browserify/index.js","./dist-esm/src/credentials/azureCliCredential.js":"./dist-esm/src/credentials/azureCliCredential.browser.js","./dist-esm/src/credentials/deviceCodeCredential.js":"./dist-esm/src/credentials/deviceCodeCredential.browser.js","./dist-esm/src/credentials/environmentCredential.js":"./dist-esm/src/credentials/environmentCredential.browser.js","./dist-esm/src/credentials/managedIdentityCredential.js":"./dist-esm/src/credentials/managedIdentityCredential.browser.js","./dist-esm/src/credentials/authorizationCodeCredential.js":"./dist-esm/src/credentials/authorizationCodeCredential.browser.js","./dist-esm/src/credentials/clientCertificateCredential.js":"./dist-esm/src/credentials/clientCertificateCredential.browser.js","./dist-esm/src/credentials/interactiveBrowserCredential.js":"./dist-esm/src/credentials/interactiveBrowserCredential.browser.js"},"scripts":{"lint":"eslint package.json tsconfig.json src test samples --ext .ts -f html -o identity-lintReport.html || exit 0","pack":"npm pack 2>&1","test":"npm run build:test && npm run unit-test && npm run integration-test","audit":"node ../../../common/scripts/rush-audit.js && rimraf node_modules package-lock.json && npm i --package-lock-only 2>&1 && npm audit","build":"npm run extract-api && tsc -p . && rollup -c 2>&1","clean":"rimraf dist dist-esm dist-browser test-dist test-browser typings *.tgz *.log","format":"prettier --write --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"","lint:fix":"eslint package.json tsconfig.json src test samples --ext .ts --fix --fix-type [problem,suggestion]","prebuild":"npm run clean","test:node":"npm run build:test && npm run unit-test:node && npm run integration-test:node","unit-test":"npm run unit-test:node && npm run unit-test:browser","build:node":"tsc -p . && cross-env ONLY_NODE=true rollup -c 2>&1","build:test":"tsc -p . && rollup -c rollup.test.config.js 2>&1","extract-api":"tsc -p . && api-extractor run --local","check-format":"prettier --list-different --config ../../.prettierrc.json \"src/**/*.ts\" \"test/**/*.ts\" \"*.{js,json}\"","test:browser":"npm run build:test && npm run unit-test:browser && npm run integration-test:browser","build:browser":"tsc -p . && cross-env ONLY_BROWSER=true rollup -c 2>&1","build:samples":"cd samples && tsc -p .","unit-test:node":"mocha test-dist/**/*.js --reporter mocha-multi --reporter-options spec=-,mocha-junit-reporter=-","build:test:node":"tsc -p . && cross-env ONLY_NODE=true rollup -c rollup.test.config.js 2>&1","execute:samples":"echo skipped","integration-test":"npm run integration-test:node && npm run integration-test:browser","unit-test:browser":"karma start","build:test:browser":"tsc -p . && cross-env ONLY_BROWSER=true rollup -c rollup.test.config.js 2>&1","integration-test:node":"echo skipped","integration-test:browser":"echo skipped"},"_npmUser":{"name":"azure-sdk","email":"azure-sdk-npmjs@microsoft.com"},"sdk-type":"client","_resolved":"","_integrity":"","repository":{"url":"git+https://github.com/Azure/azure-sdk-for-js.git","type":"git"},"_npmVersion":"6.14.1","description":"Provides credential implementations for Azure SDK libraries that can authenticate with Azure Active Directory","directories":{},"sideEffects":false,"_nodeVersion":"12.16.1","dependencies":{"qs":"^6.7.0","jws":"^3.2.2","msal":"^1.0.2","uuid":"^3.3.2","tslib":"^1.10.0","events":"^3.0.0","@azure/logger":"^1.0.0","@azure/core-http":"^1.0.0","@azure/core-tracing":"1.0.0-preview.7","@opentelemetry/types":"^0.2.0"},"_hasShrinkwrap":false,"readmeFilename":"README.md","devDependencies":{"open":"^7.0.0","util":"^0.12.1","karma":"^4.0.1","mocha":"^6.2.2","assert":"^1.4.1","eslint":"^6.1.0","rimraf":"^3.0.0","rollup":"^1.16.3","express":"^4.16.3","inherits":"^2.0.3","prettier":"^1.16.4","@types/qs":"^6.5.3","cross-env":"^6.0.3","puppeteer":"^2.0.0","@types/jws":"^3.2.0","typescript":"~3.7.5","@types/node":"^8.0.0","@types/uuid":"^3.4.3","karma-mocha":"^1.3.0","mocha-multi":"^1.1.3","@types/mocha":"^5.2.5","@types/express":"^4.16.0","karma-coverage":"^2.0.0","@rollup/plugin-json":"^4.0.0","karma-junit-reporter":"^2.0.1","karma-mocha-reporter":"^2.2.5","karma-remap-istanbul":"^0.6.0","mocha-junit-reporter":"^1.18.0","rollup-plugin-terser":"^5.1.1","karma-chrome-launcher":"^3.0.0","@rollup/plugin-replace":"^2.2.0","karma-env-preprocessor":"^0.1.1","@azure/abort-controller":"^1.0.0","@rollup/plugin-commonjs":"^11.0.1","@microsoft/api-extractor":"^7.5.4","rollup-plugin-sourcemaps":"^0.4.2","rollup-plugin-visualizer":"^3.1.1","@typescript-eslint/parser":"^2.0.0","@rollup/plugin-multi-entry":"^3.0.0","@rollup/plugin-node-resolve":"^7.0.0","@typescript-eslint/eslint-plugin":"^2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/identity_1.1.0-preview1_1583880612473_0.9539001760772357","host":"s3://npm-registry-packages"},"publish_time":1583880612708,"_cnpm_publish_time":1583880612708,"dist-tags":{"beta":"4.15.0-beta.2","dev":"4.14.0-alpha.20260310.1","latest":"4.14.1"}}