msal
- Version 1.4.18
- Published
- 3.01 MB
- 1 dependency
- MIT license
Install
npm i msal
yarn add msal
pnpm add msal
Overview
@azure/msal
Index
Variables
Classes
ClientAuthError
- createAcquireTokenInProgressError()
- createBlockTokenRequestsInHiddenIframeError()
- createCacheParseError()
- createClientInfoDecodingError()
- createClientInfoNotPopulatedError()
- createEndpointResolutionError()
- createErrorInCallbackFunction()
- createIdTokenNullOrEmptyError()
- createIdTokenParsingError()
- createInvalidIdTokenError()
- createInvalidInteractionTypeError()
- createInvalidStateError()
- createLoginInProgressError()
- createNonceMismatchError()
- createPopupWindowError()
- createTokenEncodingError()
- createTokenRenewalTimeoutError()
- createUserCancelledError()
- createUserDoesNotExistError()
- createUserLoginRequiredError()
ClientConfigurationError
- createClaimsRequestParsingError()
- createEmptyRequestError()
- createEmptyScopesArrayError()
- createInvalidAuthorityMetadataError()
- createInvalidAuthorityTypeError()
- createInvalidCallbackObjectError()
- createInvalidCorrelationIdError()
- createInvalidPromptError()
- createKnownAuthoritiesNotSetError()
- createNoSetConfigurationError()
- createRedirectCallbacksNotSetError()
- createScopesNonArrayError()
- createScopesRequiredError()
- createSsoSilentError()
- createStorageNotSupportedError()
- createTelemetryConfigError()
- createUntrustedAuthorityError()
Constants
- adalIdToken
- ADFS
- cacheDelimiter
- cachePrefix
- claims
- clientId
- common
- domain_hint
- homeAccountIdentifier
- inProgress
- interactionTypePopup
- interactionTypeRedirect
- interactionTypeSilent
- libraryName
- login
- no_account
- oidcScopes
- openidScope
- popUpHeight
- popUpWidth
- profileScope
- prompt
- prompt_none
- prompt_select_account
- renewToken
- resourceDelimiter
- response_mode_fragment
- scopes
- unknown
- upn
UrlUtils
- CanonicalizeUri()
- constructAuthorityUriFromObject()
- createNavigateUrl()
- createNavigationUrlString()
- deserializeHash()
- endsWith()
- getCurrentUrl()
- getHashFromUrl()
- getHostFromUri()
- GetUrlComponents()
- isCommonAuthority()
- isConsumersAuthority()
- isOrganizationsAuthority()
- removeHashFromUrl()
- replaceTenantPath()
- urlContainsHash()
- urlRemoveQueryStringParameter()
UserAgentApplication
- acquireTokenPopup()
- acquireTokenRedirect()
- acquireTokenSilent()
- authority
- authorityInstance
- cacheStorage
- clearCache()
- clearCacheForScope()
- getAccount()
- getAccountState()
- getAcquireTokenInProgress()
- getAllAccounts()
- getAuthorityInstance()
- getCachedTokenInternal()
- getCurrentConfiguration()
- getLogger()
- getLoginInProgress()
- getPostLogoutRedirectUri()
- getRedirectUri()
- getResponseState()
- getScopesForEndpoint()
- handleRedirectCallback()
- isCallback()
- loginPopup()
- loginRedirect()
- logout()
- saveTokenFromHash()
- setAcquireTokenInProgress()
- setInteractionInProgress()
- setLogger()
- setloginInProgress()
- ssoSilent()
- urlContainsHash()
Interfaces
Enums
Type Aliases
Variables
variable version
const version: string;
Classes
class Account
class 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)
constructor
constructor( accountIdentifier: string, homeAccountIdentifier: string, userName: string, name: string, idTokenClaims: StringDict, sid: string, environment: string);
Creates an Account Object accountIdentifier
Parameter homeAccountIdentifier
Parameter userName
Parameter name
Parameter idToken
Parameter sid
Parameter environment
property accountIdentifier
accountIdentifier: string;
property environment
environment: string;
property homeAccountIdentifier
homeAccountIdentifier: string;
property idToken
idToken: StringDict;
property idTokenClaims
idTokenClaims: StringDict;
property name
name: string;
property sid
sid: string;
property userName
userName: string;
method compareAccounts
static compareAccounts: (a1: Account, a2: Account) => boolean;
Utils function to compare two Account objects - used to check if the same user account is logged in
Parameter a1
: Account object
Parameter a2
: Account object
method createAccount
static createAccount: (idToken: IdToken, clientInfo: ClientInfo) => Account;
Parameter idToken
Parameter clientInfo
class AuthError
class AuthError extends Error {}
General error class thrown by the MSAL.js library.
constructor
constructor(errorCode: string, errorMessage?: string);
property errorCode
errorCode: string;
property errorMessage
errorMessage: string;
method createNoWindowObjectError
static createNoWindowObjectError: (errDesc: string) => AuthError;
method createUnexpectedError
static createUnexpectedError: (errDesc: string) => AuthError;
class Authority
class Authority {}
constructor
constructor( authority: string, validateAuthority: boolean, authorityMetadata?: ITenantDiscoveryResponse);
property AuthorityType
readonly AuthorityType: AuthorityType;
property AuthorizationEndpoint
readonly AuthorizationEndpoint: string;
property CanonicalAuthority
CanonicalAuthority: string;
A URL that is the authority set by the developer
property CanonicalAuthorityUrlComponents
readonly CanonicalAuthorityUrlComponents: IUri;
property DefaultOpenIdConfigurationEndpoint
readonly DefaultOpenIdConfigurationEndpoint: string;
property EndSessionEndpoint
readonly EndSessionEndpoint: string;
property IsValidationEnabled
IsValidationEnabled: boolean;
property SelfSignedJwtAudience
readonly SelfSignedJwtAudience: string;
property Tenant
readonly Tenant: string;
method GetOpenIdConfigurationEndpoint
GetOpenIdConfigurationEndpoint: () => string;
Returns a promise which resolves to the OIDC endpoint Only responds with the endpoint
method hasCachedMetadata
hasCachedMetadata: () => boolean;
Checks if there is a cached tenant discovery response with required fields.
method isAdfs
static isAdfs: (authorityUrl: string) => boolean;
method resolveEndpointsAsync
resolveEndpointsAsync: ( telemetryManager: TelemetryManager, correlationId: string) => Promise<ITenantDiscoveryResponse>;
Returns a promise. Checks to see if the authority is in the cache Discover endpoints via openid-configuration If successful, caches the endpoint for later use in OIDC
class ClientAuthError
class ClientAuthError extends AuthError {}
Error thrown when there is an error in the client code running on the browser.
constructor
constructor(errorCode: string, errorMessage?: string);
method createAcquireTokenInProgressError
static createAcquireTokenInProgressError: () => ClientAuthError;
method createBlockTokenRequestsInHiddenIframeError
static createBlockTokenRequestsInHiddenIframeError: () => ClientAuthError;
method createCacheParseError
static createCacheParseError: (key: string) => ClientAuthError;
method createClientInfoDecodingError
static createClientInfoDecodingError: (caughtError: string) => ClientAuthError;
method createClientInfoNotPopulatedError
static createClientInfoNotPopulatedError: ( caughtError: string) => ClientAuthError;
method createEndpointResolutionError
static createEndpointResolutionError: (errDetail?: string) => ClientAuthError;
method createErrorInCallbackFunction
static createErrorInCallbackFunction: (errorDesc: string) => ClientAuthError;
method createIdTokenNullOrEmptyError
static createIdTokenNullOrEmptyError: ( invalidRawTokenString: string) => ClientAuthError;
method createIdTokenParsingError
static createIdTokenParsingError: ( caughtParsingError: string) => ClientAuthError;
method createInvalidIdTokenError
static createInvalidIdTokenError: (idToken: IdToken) => ClientAuthError;
method createInvalidInteractionTypeError
static createInvalidInteractionTypeError: () => ClientAuthError;
method createInvalidStateError
static createInvalidStateError: ( invalidState: string, actualState: string) => ClientAuthError;
method createLoginInProgressError
static createLoginInProgressError: () => ClientAuthError;
method createNonceMismatchError
static createNonceMismatchError: ( invalidNonce: string, actualNonce: string) => ClientAuthError;
method createPopupWindowError
static createPopupWindowError: (errDetail?: string) => ClientAuthError;
method createTokenEncodingError
static createTokenEncodingError: ( incorrectlyEncodedToken: string) => ClientAuthError;
method createTokenRenewalTimeoutError
static createTokenRenewalTimeoutError: () => ClientAuthError;
method createUserCancelledError
static createUserCancelledError: () => ClientAuthError;
method createUserDoesNotExistError
static createUserDoesNotExistError: () => ClientAuthError;
method createUserLoginRequiredError
static createUserLoginRequiredError: () => ClientAuthError;
class ClientConfigurationError
class ClientConfigurationError extends ClientAuthError {}
Error thrown when there is an error in configuration of the .js library.
constructor
constructor(errorCode: string, errorMessage?: string);
method createClaimsRequestParsingError
static createClaimsRequestParsingError: ( claimsRequestParseError: string) => ClientConfigurationError;
method createEmptyRequestError
static createEmptyRequestError: () => ClientConfigurationError;
method createEmptyScopesArrayError
static createEmptyScopesArrayError: ( scopesValue: string) => ClientConfigurationError;
method createInvalidAuthorityMetadataError
static createInvalidAuthorityMetadataError: () => ClientConfigurationError;
method createInvalidAuthorityTypeError
static createInvalidAuthorityTypeError: () => ClientConfigurationError;
method createInvalidCallbackObjectError
static createInvalidCallbackObjectError: ( callbackObject: object) => ClientConfigurationError;
method createInvalidCorrelationIdError
static createInvalidCorrelationIdError: () => ClientConfigurationError;
method createInvalidPromptError
static createInvalidPromptError: ( promptValue: string) => ClientConfigurationError;
method createKnownAuthoritiesNotSetError
static createKnownAuthoritiesNotSetError: () => ClientConfigurationError;
method createNoSetConfigurationError
static createNoSetConfigurationError: () => ClientConfigurationError;
method createRedirectCallbacksNotSetError
static createRedirectCallbacksNotSetError: () => ClientConfigurationError;
method createScopesNonArrayError
static createScopesNonArrayError: ( scopesValue: string) => ClientConfigurationError;
method createScopesRequiredError
static createScopesRequiredError: ( scopesValue: string[]) => ClientConfigurationError;
method createSsoSilentError
static createSsoSilentError: () => ClientConfigurationError;
method createStorageNotSupportedError
static createStorageNotSupportedError: ( givenCacheLocation: string) => ClientConfigurationError;
method createTelemetryConfigError
static createTelemetryConfigError: ( config: TelemetryOptions) => ClientConfigurationError;
method createUntrustedAuthorityError
static createUntrustedAuthorityError: (host: string) => ClientConfigurationError;
class Constants
class Constants {}
Constants
property adalIdToken
static readonly adalIdToken: string;
property ADFS
static readonly ADFS: string;
property cacheDelimiter
static readonly cacheDelimiter: string;
property cachePrefix
static readonly cachePrefix: string;
property claims
static readonly claims: string;
property clientId
static readonly clientId: string;
property common
static readonly common: string;
property domain_hint
static readonly domain_hint: string;
property homeAccountIdentifier
static readonly homeAccountIdentifier: string;
property inProgress
static readonly inProgress: string;
property interactionTypePopup
static readonly interactionTypePopup: InteractionType;
property interactionTypeRedirect
static readonly interactionTypeRedirect: InteractionType;
property interactionTypeSilent
static readonly interactionTypeSilent: InteractionType;
property libraryName
static readonly libraryName: string;
property login
static readonly login: string;
property no_account
static readonly no_account: string;
property oidcScopes
static readonly oidcScopes: string[];
property openidScope
static readonly openidScope: string;
property popUpHeight
static popUpHeight: number;
property popUpWidth
static popUpWidth: number;
property profileScope
static readonly profileScope: string;
property prompt
static readonly prompt: string;
property prompt_none
static readonly prompt_none: string;
property prompt_select_account
static readonly prompt_select_account: string;
property renewToken
static readonly renewToken: string;
property resourceDelimiter
static readonly resourceDelimiter: string;
property response_mode_fragment
static readonly response_mode_fragment: string;
property scopes
static readonly scopes: string;
property unknown
static readonly unknown: string;
property upn
static readonly upn: string;
class CryptoUtils
class CryptoUtils {}
method base64Decode
static base64Decode: (input: string) => string;
Decodes a base64 encoded string.
Parameter input
method base64Encode
static base64Encode: (input: string) => string;
encoding string to base64 - platform specific check
Parameter input
method createNewGuid
static createNewGuid: () => string;
Creates a new random GUID
Returns
string (GUID)
method decimalToHex
static decimalToHex: (num: number) => string;
Decimal to Hex
Parameter num
method deserialize
static deserialize: (query: string) => object;
deserialize a string
Parameter query
method isGuid
static isGuid: (guid: string) => boolean;
verifies if a string is GUID
Parameter guid
class InteractionRequiredAuthError
class InteractionRequiredAuthError extends ServerError {}
Error thrown when the user is required to perform an interactive token request.
constructor
constructor(errorCode: string, errorMessage?: string);
method createConsentRequiredAuthError
static createConsentRequiredAuthError: ( errorDesc: string) => InteractionRequiredAuthError;
method createInteractionRequiredAuthError
static createInteractionRequiredAuthError: ( errorDesc: string) => InteractionRequiredAuthError;
method createLoginRequiredAuthError
static createLoginRequiredAuthError: ( errorDesc: string) => InteractionRequiredAuthError;
method isInteractionRequiredError
static isInteractionRequiredError: (errorString: string) => boolean;
class Logger
class Logger {}
constructor
constructor( localCallback: ILoggerCallback, options?: { correlationId?: string; level?: LogLevel; piiLoggingEnabled?: boolean; });
method error
error: (message: string) => void;
method errorPii
errorPii: (message: string) => void;
method executeCallback
executeCallback: ( level: LogLevel, message: string, containsPii: boolean) => void;
method info
info: (message: string) => void;
method infoPii
infoPii: (message: string) => void;
method isPiiLoggingEnabled
isPiiLoggingEnabled: () => boolean;
method verbose
verbose: (message: string) => void;
method verbosePii
verbosePii: (message: string) => void;
method warning
warning: (message: string) => void;
method warningPii
warningPii: (message: string) => void;
class ServerError
class ServerError extends AuthError {}
Error thrown when there is an error with the server code, for example, unavailability.
constructor
constructor(errorCode: string, errorMessage?: string);
method createServerUnavailableError
static createServerUnavailableError: () => ServerError;
method createUnknownServerError
static createUnknownServerError: (errorDesc: string) => ServerError;
class UrlUtils
class UrlUtils {}
method CanonicalizeUri
static CanonicalizeUri: (url: string) => string;
Given a url or path, append a trailing slash if one doesnt exist
Parameter url
method constructAuthorityUriFromObject
static constructAuthorityUriFromObject: ( urlObject: IUri, pathArray: string[]) => string;
method createNavigateUrl
static createNavigateUrl: ( serverRequestParams: ServerRequestParameters) => string;
generates the URL with QueryString Parameters
Parameter scopes
method createNavigationUrlString
static createNavigationUrlString: ( serverRequestParams: ServerRequestParameters) => Array<string>;
Generate the array of all QueryStringParams to be sent to the server
Parameter scopes
method deserializeHash
static deserializeHash: (urlFragment: string) => object;
Returns deserialized portion of URL hash
method endsWith
static endsWith: (url: string, suffix: string) => boolean;
Checks to see if the url ends with the suffix Required because we are compiling for es5 instead of es6
Parameter url
Parameter str
method getCurrentUrl
static getCurrentUrl: () => string;
Returns current window URL as redirect uri
method getHashFromUrl
static getHashFromUrl: (urlStringOrFragment: string) => string;
Returns the anchor part(#) of the URL
method getHostFromUri
static getHostFromUri: (uri: string) => string;
Parameter URI
Returns
{string} host from the URI
extract URI from the host
method GetUrlComponents
static GetUrlComponents: (url: string) => IUri;
Parses out the components from a url string.
Returns
An object with the various components. Please cache this value insted of calling this multiple times on the same url.
method isCommonAuthority
static isCommonAuthority: (url: string) => boolean;
Checks if an authority is common (ex. https://a:b/common/)
Parameter url
The url
Returns
true if authority is common and false otherwise
method isConsumersAuthority
static isConsumersAuthority: (url: string) => boolean;
Checks if an authority is for consumers (ex. https://a:b/consumers/)
Parameter url
The url
Returns
true if authority is for and false otherwise
method isOrganizationsAuthority
static isOrganizationsAuthority: (url: string) => boolean;
Checks if an authority is for organizations (ex. https://a:b/organizations/)
Parameter url
The url
Returns
true if authority is for and false otherwise
method removeHashFromUrl
static removeHashFromUrl: (url: string) => string;
Returns given URL with query string removed
method replaceTenantPath
static replaceTenantPath: (url: string, tenantId: string) => string;
Given a url like https://a:b/common/d?e=f#g, and a tenantId, returns https://a:b/tenantId/d
Parameter href
The url
Parameter tenantId
The tenant id to replace
method urlContainsHash
static urlContainsHash: (urlString: string) => boolean;
Check if the url contains a hash with known properties
method urlRemoveQueryStringParameter
static urlRemoveQueryStringParameter: (url: string, name: string) => string;
Utils function to remove the login_hint and domain_hint from the i/p extraQueryParameters
Parameter url
Parameter name
class UserAgentApplication
class UserAgentApplication {}
UserAgentApplication class
Object Instance that the developer can use to make loginXX OR acquireTokenXX functions
constructor
constructor(configuration: Configuration);
Constructor for the UserAgentApplication used to instantiate the UserAgentApplication object
Important attributes in the Configuration object for auth are: - clientID: the application ID of your application. You can obtain one by registering your application with our Application registration portal : https://portal.azure.com/#blade/Microsoft_AAD_IAM/ActiveDirectoryMenuBlade/RegisteredAppsPreview - authority: the authority URL for your application.
In Azure AD, authority is a URL indicating the Azure active directory that MSAL uses to obtain tokens. It is of the form https://login.microsoftonline.com/<Enter_the_Tenant_Info_Here>. If your application supports Accounts in one organizational directory, replace "Enter_the_Tenant_Info_Here" value with the Tenant Id or Tenant name (for example, contoso.microsoft.com). If your application supports Accounts in any organizational directory, replace "Enter_the_Tenant_Info_Here" value with organizations. If your application supports Accounts in any organizational directory and personal Microsoft accounts, replace "Enter_the_Tenant_Info_Here" value with common. To restrict support to Personal Microsoft accounts only, replace "Enter_the_Tenant_Info_Here" value with consumers.
In Azure B2C, authority is of the form https://<instance>/tfp/<tenant>/<policyName>/
Parameter
Configuration configuration object for the MSAL UserAgentApplication instance
property authority
authority: string;
Method to manage the authority URL.
Returns
{string} authority
property authorityInstance
protected authorityInstance: Authority;
property cacheStorage
protected cacheStorage: AuthCache;
method acquireTokenPopup
acquireTokenPopup: ( userRequest: AuthenticationParameters) => Promise<AuthResponse>;
Use when you want to obtain an access_token for your API via opening a popup window in the user's browser
Parameter
To renew idToken, please pass clientId as the only scope in the Authentication Parameters
Returns
{Promise.} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the AuthResponse object
method acquireTokenRedirect
acquireTokenRedirect: (userRequest: AuthenticationParameters) => void;
Use when you want to obtain an access_token for your API by redirecting the user's browser window to the authorization endpoint.
Parameter
To renew idToken, please pass clientId as the only scope in the Authentication Parameters
method acquireTokenSilent
acquireTokenSilent: ( userRequest: AuthenticationParameters) => Promise<AuthResponse>;
Use this function to obtain a token before every call to the API / resource provider
MSAL return's a cached token when available Or it send's a request to the STS to obtain a new token using a hidden iframe.
Parameter
To renew idToken, please pass clientId as the only scope in the Authentication Parameters
Returns
{Promise.} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the AuthResponse object
method clearCache
protected clearCache: () => void;
Clear all access tokens and ID tokens in the cache.
method clearCacheForScope
protected clearCacheForScope: (accessToken: string) => void;
Clear a given access token from the cache.
Parameter accessToken
method getAccount
getAccount: () => Account;
Returns the signed in account (the account object is created at the time of successful login) or null when no state is found
Returns
Account - the account object stored in MSAL
method getAccountState
getAccountState: (state: string) => string;
Extracts state value from the accountState sent with the authentication request.
Returns
{string} scope.
method getAcquireTokenInProgress
protected getAcquireTokenInProgress: () => boolean;
returns the status of acquireTokenInProgress
method getAllAccounts
getAllAccounts: () => Array<Account>;
Use to get a list of unique accounts in MSAL cache based on homeAccountIdentifier.
Parameter
Account - all unique accounts in MSAL cache.
method getAuthorityInstance
getAuthorityInstance: () => Authority;
Get the current authority instance from the MSAL configuration object
Returns
Authority authority instance
method getCachedTokenInternal
protected getCachedTokenInternal: ( scopes: Array<string>, account: Account, state: string, correlationId?: string) => AuthResponse;
Helper function to retrieve the cached token
Parameter scopes
Parameter
Account account
Parameter state
AuthResponse AuthResponse
method getCurrentConfiguration
getCurrentConfiguration: () => Configuration;
Use to get the current Configuration object in MSAL
Returns
method getLogger
getLogger: () => Logger;
returns the logger handle
method getLoginInProgress
getLoginInProgress: () => boolean;
Return boolean flag to developer to help inform if login is in progress
Returns
{boolean} true/false
method getPostLogoutRedirectUri
getPostLogoutRedirectUri: () => string;
Use to get the post logout redirect uri configured in MSAL or null. Evaluates postLogoutredirectUri if its a function, otherwise simply returns its value.
Returns
{string} post logout redirect URL
method getRedirectUri
getRedirectUri: (reqRedirectUri?: string) => string;
Use to get the redirect uri configured in MSAL or null. Evaluates redirectUri if its a function, otherwise simply returns its value.
Returns
{string} redirect URL
method getResponseState
protected getResponseState: (hash: string) => ResponseStateInfo;
Creates a stateInfo object from the URL fragment and returns it.
Parameter hash
Hash passed from redirect page
Returns
{TokenResponse} an object created from the redirect response from AAD comprising of the keys - parameters, requestType, stateMatch, stateResponse and valid.
method getScopesForEndpoint
protected getScopesForEndpoint: (endpoint: string) => Array<string>;
Get scopes for the Endpoint - Used in Angular to track protected and unprotected resources without interaction from the developer app Note: Please check if we need to set the "redirectUri" from the "request" which makes this call from Angular - for this.getRedirectUri()
Parameter endpoint
method handleRedirectCallback
handleRedirectCallback: { ( tokenReceivedCallback: tokenReceivedCallback, errorReceivedCallback: errorReceivedCallback ): void; (authCallback: authResponseCallback): void;};
Set the callback functions for the redirect flow to send back the success or error object.
Parameter
tokenReceivedCallback successCallback - Callback which contains the AuthResponse object, containing data from the server.
Parameter
errorReceivedCallback errorCallback - Callback which contains a AuthError object, containing error data from either the server or the library, depending on the origin of the error.
method isCallback
isCallback: (hash: string) => boolean;
Checks if the redirect response is received from the STS. In case of redirect, the url fragment has either id_token, access_token or error.
Parameter hash
Hash passed from redirect page.
Returns
{Boolean} - true if response contains id_token, access_token or error, false otherwise.
method loginPopup
loginPopup: (userRequest?: AuthenticationParameters) => Promise<AuthResponse>;
Use when initiating the login process via opening a popup window in the user's browser
Parameter
Returns
{Promise.} - a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the AuthResponse object
method loginRedirect
loginRedirect: (userRequest?: AuthenticationParameters) => void;
Use when initiating the login process by redirecting the user's browser to the authorization endpoint.
Parameter
method logout
logout: (correlationId?: string) => void;
Use to log out the current user, and redirect the user to the postLogoutRedirectUri. Default behaviour is to redirect the user to
window.location.href
.
method saveTokenFromHash
protected saveTokenFromHash: ( hash: string, stateInfo: ResponseStateInfo) => AuthResponse;
Saves token or error received in the response from AAD in the cache. In case of id_token, it also creates the account object.
method setAcquireTokenInProgress
protected setAcquireTokenInProgress: (acquireTokenInProgress: boolean) => void;
Parameter acquireTokenInProgress
method setInteractionInProgress
protected setInteractionInProgress: (inProgress: boolean) => void;
Parameter loginInProgress
method setLogger
setLogger: (logger: Logger) => void;
Sets the logger callback.
Parameter logger
Logger callback
method setloginInProgress
protected setloginInProgress: (loginInProgress: boolean) => void;
Parameter loginInProgress
method ssoSilent
ssoSilent: (request: AuthenticationParameters) => Promise<AuthResponse>;
API interfacing idToken request when applications already have a session/hint acquired by authorization client applications
Parameter request
method urlContainsHash
urlContainsHash: (hash: string) => boolean;
Public API to verify if the URL contains the hash with known properties
Parameter hash
class WindowUtils
class WindowUtils {}
method addHiddenIFrame
static addHiddenIFrame: (iframeId: string, logger: Logger) => HTMLIFrameElement;
Adds the hidden iframe for silent token renewal.
method blockReloadInHiddenIframes
static blockReloadInHiddenIframes: () => void;
blocks any login/acquireToken calls to reload from within a hidden iframe (generated for silent calls)
method checkIfBackButtonIsPressed
static checkIfBackButtonIsPressed: (cacheStorage: AuthCache) => void;
Parameter cacheStorage
method clearUrlFragment
static clearUrlFragment: (contentWindow: Window) => void;
Removes url fragment from browser url
method closePopups
static closePopups: () => void;
Close all popups
method generateFrameName
static generateFrameName: (prefix: string, requestSignature: string) => string;
Parameter prefix
Parameter scopes
Parameter authority
method getIframeWithHash
static getIframeWithHash: (hash: string) => HTMLIFrameElement;
Find and return the iframe element with the given hash
method getPopups
static getPopups: () => Array<Window>;
Returns an array of all the popups opened by MSAL
method getPopUpWithHash
static getPopUpWithHash: (hash: string) => Window;
Find and return the popup with the given hash
method isInIframe
static isInIframe: () => boolean;
Checks if the current page is running in an iframe.
method isInPopup
static isInPopup: () => boolean;
Check if the current page is running in a popup.
method loadFrame
static loadFrame: ( urlNavigate: string, frameName: string, timeoutMs: number, logger: Logger) => Promise<HTMLIFrameElement>;
Loads iframe with authorization endpoint URL
method loadFrameSync
static loadFrameSync: ( urlNavigate: string, frameName: string, logger: Logger) => HTMLIFrameElement;
Loads the iframe synchronously when the navigateTimeFrame is set to
0
Parameter urlNavigate
Parameter frameName
Parameter logger
method monitorIframeForHash
static monitorIframeForHash: ( contentWindow: Window, timeout: number, urlNavigate: string, logger: Logger) => Promise<string>;
Polls an iframe until it loads a url with a hash
method monitorPopupForHash
static monitorPopupForHash: ( contentWindow: Window, timeout: number, urlNavigate: string, logger: Logger) => Promise<string>;
Polls a popup until it loads a url with a hash
method removeHiddenIframe
static removeHiddenIframe: (iframe: HTMLIFrameElement) => void;
Removes a hidden iframe from the page.
method trackPopup
static trackPopup: (popup: Window) => void;
Add the popup to the known list of popups
Interfaces
interface CacheResult
interface CacheResult {}
Enums
enum LogLevel
enum LogLevel { Error = 0, Warning = 1, Info = 2, Verbose = 3,}
enum ServerHashParamKeys
enum ServerHashParamKeys { SCOPE = 'scope', STATE = 'state', ERROR = 'error', ERROR_DESCRIPTION = 'error_description', ACCESS_TOKEN = 'access_token', ID_TOKEN = 'id_token', EXPIRES_IN = 'expires_in', SESSION_STATE = 'session_state', CLIENT_INFO = 'client_info',}
Keys in the hashParams
member ACCESS_TOKEN
ACCESS_TOKEN = 'access_token'
member CLIENT_INFO
CLIENT_INFO = 'client_info'
member ERROR
ERROR = 'error'
member ERROR_DESCRIPTION
ERROR_DESCRIPTION = 'error_description'
member EXPIRES_IN
EXPIRES_IN = 'expires_in'
member ID_TOKEN
ID_TOKEN = 'id_token'
member SCOPE
SCOPE = 'scope'
member SESSION_STATE
SESSION_STATE = 'session_state'
member STATE
STATE = 'state'
Type Aliases
type AuthenticationParameters
type AuthenticationParameters = { scopes?: Array<string>; extraScopesToConsent?: Array<string>; prompt?: string; extraQueryParameters?: StringDict; claimsRequest?: string; authority?: string; state?: string; correlationId?: string; account?: Account; sid?: string; loginHint?: string; forceRefresh?: boolean; redirectUri?: string; redirectStartPage?: string; authorityMetadata?: string; onRedirectNavigate?: (url: string) => void | boolean;};
AuthenticationParameters}AuthenticationParameters
type AuthResponse
type AuthResponse = { uniqueId: string; tenantId: string; tokenType: string; idToken: IdToken; idTokenClaims: StringDict; accessToken: string; scopes: Array<string>; expiresOn: Date; account: Account; accountState: string; fromCache: boolean;};
type authResponseCallback
type authResponseCallback = (authErr: AuthError, response?: AuthResponse) => void;
A type alias for an authResponseCallback function. authResponseCallback
Parameter authErr
error created for failure cases
Parameter response
response containing token strings in success cases, or just state value in error cases
type CacheLocation
type CacheLocation = 'localStorage' | 'sessionStorage';
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
type Configuration
type Configuration = { auth: AuthOptions; cache?: CacheOptions; system?: SystemOptions; framework?: FrameworkOptions;};
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.
type errorReceivedCallback
type errorReceivedCallback = (authErr: AuthError, accountState: string) => void;
A type alias for a errorReceivedCallback function. errorReceivedCallback
Returns
{string} account state
type tokenReceivedCallback
type tokenReceivedCallback = (response: AuthResponse) => void;
A type alias for a tokenReceivedCallback function. tokenReceivedCallback
Returns
response of type AuthResponse The function that will get the call back once this API is completed (either successfully or with a failure).
Package Files (18)
- lib-commonjs/Account.d.ts
- lib-commonjs/AuthResponse.d.ts
- lib-commonjs/AuthenticationParameters.d.ts
- lib-commonjs/Configuration.d.ts
- lib-commonjs/Logger.d.ts
- lib-commonjs/UserAgentApplication.d.ts
- lib-commonjs/authority/Authority.d.ts
- lib-commonjs/error/AuthError.d.ts
- lib-commonjs/error/ClientAuthError.d.ts
- lib-commonjs/error/ClientConfigurationError.d.ts
- lib-commonjs/error/InteractionRequiredAuthError.d.ts
- lib-commonjs/error/ServerError.d.ts
- lib-commonjs/index.d.ts
- lib-commonjs/packageMetadata.d.ts
- lib-commonjs/utils/Constants.d.ts
- lib-commonjs/utils/CryptoUtils.d.ts
- lib-commonjs/utils/UrlUtils.d.ts
- lib-commonjs/utils/WindowUtils.d.ts
Dependencies (1)
Dev Dependencies (38)
- @azure/storage-blob
- @babel/core
- @babel/plugin-proposal-class-properties
- @babel/plugin-proposal-object-rest-spread
- @babel/polyfill
- @babel/preset-env
- @babel/preset-typescript
- @babel/register
- @types/handlebars
- @types/jest
- @types/js-base64
- @types/node
- @types/sinon
- @types/uuid
- ajv
- babel-polyfill
- dotenv
- fork-ts-checker-webpack-plugin
- handlebars
- husky
- jest
- js-yaml
- jshint
- phantomjs-polyfill
- rimraf
- shx
- sinon
- source-map-support
- ssri
- terser-webpack-plugin
- ts-jest
- ts-loader
- ts-node
- tslint
- typescript
- webpack
- webpack-cli
- webpack-dev-middleware
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/msal
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/msal)
- HTML<a href="https://www.jsdocs.io/package/msal"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 8230 ms. - Missing or incorrect documentation? Open an issue for this package.