Package version:

Interface InteractiveBrowserCredentialNodeOptions

Defines the common options for the InteractiveBrowserCredential class.

interface InteractiveBrowserCredentialNodeOptions {
    additionallyAllowedTenants?: {};
    authenticationRecord?: AuthenticationRecord;
    authorityHost?: string;
    brokerOptions?: BrokerOptions;
    browserCustomizationOptions?: {
        errorMessage?: string;
        successMessage?: string;
    };
    clientId?: string;
    disableAutomaticAuthentication?: boolean;
    disableInstanceDiscovery?: boolean;
    loggingOptions?: any;
    loginHint?: string;
    redirectUri?: string | (() => string);
    tenantId?: string;
    tokenCachePersistenceOptions?: TokenCachePersistenceOptions;
}

Hierarchy (view full)

Properties

additionallyAllowedTenants?: {}

For multi-tenant applications, specifies additional tenants for which the credential may acquire tokens. Add the wildcard value "*" to allow the credential to acquire tokens for any tenant the application is installed.

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();
authorityHost?: string

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

brokerOptions?: BrokerOptions

Options to allow broker authentication when using InteractiveBrowserCredential

browserCustomizationOptions?: {
    errorMessage?: string;
    successMessage?: string;
}

Shared configuration options for browser customization

Type declaration

  • OptionalerrorMessage?: string

    Format for error messages for display in browser

  • OptionalsuccessMessage?: string

    Format for success messages for display in browser

clientId?: string

The Client ID of the Microsoft Entra application that users will sign into. It is recommended that developers register their applications and assign appropriate roles. For more information, visit https://aka.ms/identity/AppRegistrationAndRoleAssignment. If not specified, users will authenticate to an Azure development application, which is not recommended for production scenarios.

disableAutomaticAuthentication?: boolean

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

disableInstanceDiscovery?: boolean

The field determines whether instance discovery is performed when attempting to authenticate. Setting this to true will completely disable both instance discovery and authority validation. As a result, it's crucial to ensure that the configured authority host is valid and trustworthy. This functionality is intended for use in scenarios where the metadata endpoint cannot be reached, such as in private clouds or Azure Stack. The process of instance discovery entails retrieving authority metadata from https://login.microsoft.com/ to validate the authority.

loggingOptions?: any

Allows users to configure settings for logging policy options, allow logging account information and personally identifiable information for customer support.

loginHint?: string

loginHint allows a user name to be pre-selected for interactive logins. Setting this option skips the account selection prompt and immediately attempts to login with the specified account.

redirectUri?: string | (() => string)

Gets the redirect URI of the application. This should be same as the value in the application registration portal. Defaults to window.location.href. This field is no longer required for Node.js.

tenantId?: string

The Microsoft Entra tenant (directory) ID.

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 { useIdentityPlugin, DeviceCodeCredential } from "@azure/identity";

useIdentityPlugin(cachePersistencePlugin);

const credential = new DeviceCodeCredential({
tokenCachePersistenceOptions: {
enabled: true,
},
});