Options
All
  • Public
  • Public/Protected
  • All
Menu

@azure/identity

Package version

Index

Enumerations

Classes

Interfaces

Type aliases

Variables

Functions

Object literals

Type aliases

BrowserLoginStyle

BrowserLoginStyle: "redirect" | "popup"

(Browser-only feature) The "login style" to use in the authentication flow:

  • "redirect" redirects the user to the authentication page and then redirects them back to the page once authentication is completed.
  • "popup" opens a new browser window through with the redirect flow is initiated. The user's existing browser window does not leave the current page

DeviceCodePromptCallback

DeviceCodePromptCallback: (deviceCodeInfo: DeviceCodeInfo) => void

Defines the signature of a callback which will be passed to DeviceCodeCredential for the purpose of displaying authentication details to the user.

Type declaration

InteractiveBrowserCredentialBrowserOptions

InteractiveBrowserCredentialBrowserOptions: TokenCredentialOptions & InteractiveCredentialOptions & { clientId: string; loginStyle?: BrowserLoginStyle; redirectUri?: string | (() => string); tenantId?: undefined | string }

Defines the common options for the InteractiveBrowserCredential class.

InteractiveBrowserCredentialOptions

InteractiveBrowserCredentialOptions: TokenCredentialOptions & InteractiveCredentialOptions & { clientId?: undefined | string; redirectUri?: string | (() => string); tenantId?: undefined | string }

Defines the common options for the InteractiveBrowserCredential class.

MSIExpiresInParser

MSIExpiresInParser: (requestBody: any) => number

Type declaration

    • (requestBody: any): number
    • Parameters

      • requestBody: any

      Returns number

Variables

Const AggregateAuthenticationErrorName

AggregateAuthenticationErrorName: "AggregateAuthenticationError" = "AggregateAuthenticationError"

The Error.name value of an AggregateAuthenticationError

Const AuthenticationErrorName

AuthenticationErrorName: "AuthenticationError" = "AuthenticationError"

The Error.name value of an AuthenticationError

Const BrowserNotSupportedError

BrowserNotSupportedError: any = new Error("getAuthorityHostEnvironment is not supported in the browser.")

Const CredentialUnavailableErrorName

CredentialUnavailableErrorName: "CredentialUnavailableError" = "CredentialUnavailableError"

The Error.name value of an CredentialUnavailable

Const DefaultAuthorityHost

DefaultAuthorityHost: AzurePublicCloud = AzureAuthorityHosts.AzurePublicCloud

The default authority host.

Const DefaultScopeSuffix

DefaultScopeSuffix: "/.default" = "/.default"

Const azureArcAPIVersion

azureArcAPIVersion: "2019-11-01" = "2019-11-01"

Const azureFabricVersion

azureFabricVersion: "2019-07-01-preview" = "2019-07-01-preview"

Const expiresInParser

  • expiresInParser(requestBody: any): number

Const imdsApiVersion

imdsApiVersion: "2018-02-01" = "2018-02-01"

Const imdsEndpoint

imdsEndpoint: "http://169.254.169.254/metadata/identity/oauth2/token" = "http://169.254.169.254/metadata/identity/oauth2/token"

Const isWindows

isWindows: boolean = process.platform === "win32"

Const noCorrelationId

noCorrelationId: "noCorrelationId" = "noCorrelationId"

Const redirectHash

redirectHash: string = self.location.hash

Functions

checkTenantId

convertOAuthErrorResponseToErrorResponse

  • convertOAuthErrorResponseToErrorResponse(errorBody: OAuthErrorResponse): ErrorResponse

credentialLogger

  • Generates a CredentialLogger, which is a logger declared at the credential's constructor, and used at any point in the credential. It has all the properties of a CredentialLoggerInstance, plus other logger instances, one per method.

    It logs with the format:

    [title] => [message] [title] => getToken() => [message]

    Parameters

    • title: string
    • Default value log: AzureLogger = logger

    Returns CredentialLogger

credentialLoggerInstance

defaultDeviceCodePromptCallback

  • defaultDeviceCodePromptCallback(deviceCodeInfo: DeviceCodeInfo): void

deserializeAuthenticationRecord

  • Deserializes a previously serialized authentication record from a string into an object.

    The input string must contain the following properties:

    • "authority"
    • "homeAccountId"
    • "clientId"
    • "tenantId"
    • "username"
    • "version"

    If the version we receive is unsupported, an error will be thrown.

    At the moment, the only available version is: "1.0", which is always set when the authentication record is serialized.

    Parameters

    • serializedRecord: string

      Authentication record previously serialized into string.

    Returns AuthenticationRecord

    AuthenticationRecord.

filePathRequest

  • filePathRequest(identityClient: IdentityClient, requestPrepareOptions: RequestPrepareOptions): Promise<string | undefined>

formatError

  • formatError(scope: string | string[] | undefined, error: Error | string): string
  • Formatting the success event on the credentials

    Parameters

    • scope: string | string[] | undefined
    • error: Error | string

    Returns string

formatSuccess

  • formatSuccess(scope: string | string[]): string
  • Formatting the success event on the credentials

    Parameters

    • scope: string | string[]

    Returns string

getAuthorityHostEnvironment

  • getAuthorityHostEnvironment(): { authorityHost: string } | undefined

getDefaultAzureCredential

  • getDefaultAzureCredential(): TokenCredential

getIdentityTokenEndpointSuffix

  • getIdentityTokenEndpointSuffix(tenantId: string): string

getSafeWorkingDir

  • getSafeWorkingDir(): string

isErrorResponse

  • isErrorResponse(errorResponse: any): errorResponse is OAuthErrorResponse
  • Parameters

    • errorResponse: any

    Returns errorResponse is OAuthErrorResponse

Const isLoginError

  • isLoginError(err: Error): any

Const isNotInstalledError

  • isNotInstalledError(err: Error): any

logEnvVars

  • logEnvVars(credentialName: string, supportedEnvVars: string[]): void
  • Based on a given list of environment variable names, logs the environment variables currently assigned during the usage of a credential that goes by the given name.

    Parameters

    • credentialName: string

      Name of the credential in use

    • supportedEnvVars: string[]

      List of environment variables supported by that credential

    Returns void

mapScopesToResource

  • mapScopesToResource(scopes: string | string[]): string

msalToPublic

msiGenericGetToken

  • msiGenericGetToken(identityClient: IdentityClient, requestOptions: RequestPrepareOptions, expiresInParser: MSIExpiresInParser | undefined, getTokenOptions?: GetTokenOptions): Promise<AccessToken | null>

prepareRequestOptions

  • prepareRequestOptions(resource: string, clientId?: undefined | string): RequestPrepareOptions

processEnvVars

  • Separates a list of environment variable names into a plain object with two arrays: an array of missing environment variables and another array with assigned environment variables.

    Parameters

    • supportedEnvVars: string[]

      List of environment variable names

    Returns EnvironmentAccumulator

publicToMsal

readFileAsync

  • readFileAsync(path: string, options: { encoding: string }): Promise<string>

resolveTenantId

  • resolveTenantId(logger: CredentialLogger, tenantId?: undefined | string, clientId?: undefined | string): string

serializeAuthenticationRecord

  • Serializes an AuthenticationRecord into a string.

    The output of a serialized authentication record will contain the following properties:

    • "authority"
    • "homeAccountId"
    • "clientId"
    • "tenantId"
    • "username"
    • "version"

    To later convert this string to a serialized AuthenticationRecord, please use the exported function deserializeAuthenticationRecord().

    Parameters

    Returns string

Object literals

Const appServiceMsi2017

appServiceMsi2017: object

getToken

  • getToken(identityClient: IdentityClient, resource: string, clientId?: undefined | string, getTokenOptions?: GetTokenOptions): Promise<AccessToken | null>

isAvailable

  • isAvailable(): Promise<boolean>

Const arcMsi

arcMsi: object

getToken

  • getToken(identityClient: IdentityClient, resource?: undefined | string, clientId?: undefined | string, getTokenOptions?: GetTokenOptions): Promise<AccessToken | null>
  • Parameters

    • identityClient: IdentityClient
    • Optional resource: undefined | string
    • Optional clientId: undefined | string
    • Default value getTokenOptions: GetTokenOptions = {}

    Returns Promise<AccessToken | null>

isAvailable

  • isAvailable(): Promise<boolean>

Const cloudShellMsi

cloudShellMsi: object

getToken

  • getToken(identityClient: IdentityClient, resource: string, clientId?: undefined | string, getTokenOptions?: GetTokenOptions): Promise<AccessToken | null>

isAvailable

  • isAvailable(): Promise<boolean>

Const fabricMsi

fabricMsi: object

getToken

  • getToken(identityClient: IdentityClient, resource: string, clientId?: undefined | string, getTokenOptions?: GetTokenOptions): Promise<AccessToken | null>

isAvailable

  • isAvailable(): Promise<boolean>

Const imdsMsi

imdsMsi: object

getToken

  • getToken(identityClient: IdentityClient, resource: string, clientId?: undefined | string, getTokenOptions?: GetTokenOptions): Promise<AccessToken | null>

isAvailable

  • isAvailable(identityClient: IdentityClient, resource: string, clientId?: undefined | string, getTokenOptions?: GetTokenOptions): Promise<boolean>

Const imdsMsiRetryConfig

imdsMsiRetryConfig: object

intervalIncrement

intervalIncrement: number = 2

maxRetries

maxRetries: number = 3

startDelayInMs

startDelayInMs: number = 800

Generated using TypeDoc