Edit

Share via


@azure/msal package

Classes

Account

accountIdentifier combination of idToken.uid and idToken.utid homeAccountIdentifier combination of clientInfo.uid and clientInfo.utid userName idToken.preferred_username name idToken.name idToken idToken sid idToken.sid - session identifier environment idtoken.issuer (the authority that issues the token)

Logger
ScopeSet
UserAgentApplication

UserAgentApplication class Object Instance that the developer can use to make loginXX OR acquireTokenXX functions

AuthorityFactory
TrustedAuthority
AuthError

General error class thrown by the MSAL.js library.

ClientAuthError

Error thrown when there is an error in the client code running on the browser.

ClientConfigurationError

Error thrown when there is an error in configuration of the .js library.

InteractionRequiredAuthError

Error thrown when the user is required to perform an interactive token request.

ServerError

Error thrown when there is an error with the server code, for example, unavailability.

ApiEvent
DefaultEvent
HttpEvent
TelemetryEvent
TelemetryManager
WindowUtils

Interfaces

ILoggerCallback
IClientConfigurationErrorMessage
CompletedEvents
EventCount
EventCountByCorrelationId
InProgressEvents
NetworkInformation
TelemetryConfig
TelemetryPlatform

Type Aliases

AuthResponse
AuthenticationParameters
AuthOptions
CacheLocation

Cache location options supported by MSAL are:

  • local storage: MSAL uses browsers local storage to store its cache
  • session storage: MSAL uses the browsers session storage to store its cache
CacheOptions

Use this to configure the below cache configuration options:

  • cacheLocation - Used to specify the cacheLocation user wants to set. Valid values are "localStorage" and "sessionStorage"
  • storeAuthStateInCookie - If set, MSAL store's the auth request state required for validation of the auth flows in the browser cookies. By default this flag is set to false.
Configuration

Use the configuration object to configure MSAL and initialize the UserAgentApplication. This object allows you to configure important elements of MSAL functionality:

  • auth: this is where you configure auth elements like clientID, authority used for authenticating against the Microsoft Identity Platform
  • cache: this is where you configure cache location and whether to store cache in cookies
  • system: this is where you can configure the logger, frame timeout etc.
  • framework: this is where you can configure the running mode of angular. More to come here soon.
FrameworkOptions

App/Framework specific environment support

  • isAngular - flag set to determine if it is Angular Framework. MSAL uses this to broadcast tokens. More to come here: detangle this dependency from core.
  • unprotectedResources - Array of URI's which are unprotected resources. MSAL will not attach a token to outgoing requests that have these URI. Defaults to 'null'.
  • protectedResourceMap - This is mapping of resources to scopes used by MSAL for automatically attaching access tokens in web API calls.A single access token is obtained for the resource. So you can map a specific resource path as follows: {"https://graph.microsoft.com/v1.0/me", ["user.read"]}, or the app URL of the resource as: {"https://graph.microsoft.com/", ["user.read", "mail.send"]}. This is required for CORS calls.
SystemOptions

Library Specific Options

  • logger - Used to initialize the Logger object; TODO: Expand on logger details or link to the documentation on logger
  • loadFrameTimeout - maximum time the library should wait for a frame to load
  • tokenRenewalOffsetSeconds - sets the window of offset needed to renew the token before expiry
  • navigateFrameWait - sets the wait time for hidden iFrame navigation
TelemetryOptions

Telemetry Config Options

  • applicationName - Name of the consuming apps application
  • applicationVersion - Verison of the consuming application
  • telemetryEmitter - Function where telemetry events are flushed to
StringDict

Key-Value type to support queryParams, extraQueryParams and claims

authResponseCallback

A type alias for an authResponseCallback function. <xref:(authResponseCallback%3Atype)>

errorReceivedCallback

A type alias for a errorReceivedCallback function. <xref:(errorReceivedCallback%3Atype)>

tokenReceivedCallback

A type alias for a tokenReceivedCallback function. <xref:(tokenReceivedCallback%3Atype)>

XhrResponse
OpenIdConfiguration

Response type for openid-configuration endpoints

TelemetryEmitter
InteractionType
LibraryStateObject

Enums

LogLevel
API_CODE
API_EVENT_IDENTIFIER
ErrorCacheKeys
PersistentCacheKeys
ServerHashParamKeys

Keys in the hashParams

Functions

buildResponseStateOnly(string)
validateClaimsRequest(AuthenticationParameters)
buildConfiguration({ auth: { authority?: string, authorityMetadata?: string, clientId: string, knownAuthorities?: Array<string>, navigateToLoginRequestUrl?: boolean, postLogoutRedirectUri?: string | () => string, redirectUri?: string | () => string, validateAuthority?: boolean }, cache: { cacheLocation?: CacheLocation, storeAuthStateInCookie?: boolean }, framework: { isAngular?: boolean, protectedResourceMap?: Map<string, Array<string>>, unprotectedResources?: Array<string> }, system: { loadFrameTimeout?: number, logger?: Logger, navigateFrameWait?: number, telemetry?: TelemetryOptions, tokenRenewalOffsetSeconds?: number } })

MSAL function that sets the default options when not explicitly configured from app developer

libraryVersion()

MSAL JS Library Version

Function Details

buildResponseStateOnly(string)

function buildResponseStateOnly(state: string): AuthResponse

Parameters

state

string

Returns

validateClaimsRequest(AuthenticationParameters)

function validateClaimsRequest(request: AuthenticationParameters)

Parameters

buildConfiguration({ auth: { authority?: string, authorityMetadata?: string, clientId: string, knownAuthorities?: Array<string>, navigateToLoginRequestUrl?: boolean, postLogoutRedirectUri?: string | () => string, redirectUri?: string | () => string, validateAuthority?: boolean }, cache: { cacheLocation?: CacheLocation, storeAuthStateInCookie?: boolean }, framework: { isAngular?: boolean, protectedResourceMap?: Map<string, Array<string>>, unprotectedResources?: Array<string> }, system: { loadFrameTimeout?: number, logger?: Logger, navigateFrameWait?: number, telemetry?: TelemetryOptions, tokenRenewalOffsetSeconds?: number } })

MSAL function that sets the default options when not explicitly configured from app developer

function buildConfiguration(__namedParameters: { auth: { authority?: string, authorityMetadata?: string, clientId: string, knownAuthorities?: Array<string>, navigateToLoginRequestUrl?: boolean, postLogoutRedirectUri?: string | () => string, redirectUri?: string | () => string, validateAuthority?: boolean }, cache: { cacheLocation?: CacheLocation, storeAuthStateInCookie?: boolean }, framework: { isAngular?: boolean, protectedResourceMap?: Map<string, Array<string>>, unprotectedResources?: Array<string> }, system: { loadFrameTimeout?: number, logger?: Logger, navigateFrameWait?: number, telemetry?: TelemetryOptions, tokenRenewalOffsetSeconds?: number } }): Configuration

Parameters

__namedParameters

{ auth: { authority?: string, authorityMetadata?: string, clientId: string, knownAuthorities?: Array<string>, navigateToLoginRequestUrl?: boolean, postLogoutRedirectUri?: string | () => string, redirectUri?: string | () => string, validateAuthority?: boolean }, cache: { cacheLocation?: CacheLocation, storeAuthStateInCookie?: boolean }, framework: { isAngular?: boolean, protectedResourceMap?: Map<string, Array<string>>, unprotectedResources?: Array<string> }, system: { loadFrameTimeout?: number, logger?: Logger, navigateFrameWait?: number, telemetry?: TelemetryOptions, tokenRenewalOffsetSeconds?: number } }

Returns

TConfiguration object

libraryVersion()

MSAL JS Library Version

function libraryVersion(): string

Returns

string