Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface DeviceCodeCredentialOptions

Package version

Defines options for the InteractiveBrowserCredential class for Node.js.

Hierarchy

Index

Properties

Optional authenticationRecord

authenticationRecord: AuthenticationRecord

Result of a previous authentication that can be used to retrieve the cached credentials of each individual account. This is necessary to provide in case the application wants to work with more than one account per Client ID and Tenant ID pair.

This record can be retrieved by calling to the credential's authenticate() method, as follows:

const authenticationRecord = await credential.authenticate();

Optional authorityHost

authorityHost: undefined | string

The authority host to use for authentication requests. Possible values are available through AzureAuthorityHosts. The default is "https://login.microsoftonline.com".

Optional clientId

clientId: undefined | string

The client (application) ID of an App Registration in the tenant.

Optional disableAutomaticAuthentication

disableAutomaticAuthentication: undefined | false | true

Makes getToken throw if a manual authentication is necessary. Developers will need to call to authenticate() to control when to manually authenticate.

Optional loggingOptions

loggingOptions: LogPolicyOptions & { allowLoggingAccountIdentifiers?: undefined | false | true }

Allows logging account information once the authentication flow succeeds.

Optional tenantId

tenantId: undefined | string

The Azure Active Directory tenant (directory) ID.

Optional tokenCachePersistenceOptions

tokenCachePersistenceOptions: TokenCachePersistenceOptions

Options to provide to the persistence layer (if one is available) when storing credentials.

You must first register a persistence provider plugin. See the @azure/identity-cache-persistence package on NPM.

Example:

import { cachePersistencePlugin } from "@azure/identity-cache-persistence";
import { useIdentityPlugin, DeviceCodeCredential } from "@azure/identity";

useIdentityPlugin(cachePersistencePlugin);

async function main() {
  const credential = new DeviceCodeCredential({
    tokenCachePersistenceOptions: {
      enabled: true
    }
  });
}

main().catch((error) => {
  console.error("An error occurred:", error);
  process.exit(1);
});

Optional userPromptCallback

userPromptCallback: DeviceCodePromptCallback

A callback function that will be invoked to show DeviceCodeInfo to the user. If left unassigned, we will automatically log the device code information and the authentication instructions in the console.

Generated using TypeDoc