Options
All
  • Public
  • Public/Protected
  • All
Menu

UserAgentApplication class

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

Hierarchy

  • UserAgentApplication

Index

Constructors

constructor

  • constructor

    Constructor for the UserAgentApplication used to instantiate the UserAgentApplication object

    Important attributes in the Configuration object for auth are:

    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>/

    Parameters

    • configuration: Configuration

      object for the MSAL UserAgentApplication instance

    Returns UserAgentApplication

Accessors

authority

  • get authority(): string
  • set authority(val: string): void
  • Method to manage the authority URL.

    Returns string

    authority

  • setter for the authority URL

    Parameters

    • val: string

    Returns void

    authority

Methods

acquireTokenPopup

  • Use when you want to obtain an access_token for your API via opening a popup window in the user's browser

    Parameters

    Returns Promise<AuthResponse>

    • a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the AuthResponse object

acquireTokenRedirect

  • Use when you want to obtain an access_token for your API by redirecting the user's browser window to the authorization endpoint.

    Parameters

    Returns void

acquireTokenSilent

  • 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.

    Parameters

    Returns Promise<AuthResponse>

    • a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the AuthResponse object

getAccount

  • 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

getAllAccounts

  • Use to get a list of unique accounts in MSAL cache based on homeAccountIdentifier.

    Returns Array<Account>

getAuthorityInstance

  • getAuthorityInstance(): Authority
  • Get the current authority instance from the MSAL configuration object

    Returns Authority

    authority instance

getCurrentConfiguration

getLoginInProgress

  • getLoginInProgress(): boolean
  • Return boolean flag to developer to help inform if login is in progress

    Returns boolean

    true/false

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

getRedirectUri

  • getRedirectUri(): 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

loginPopup

  • Use when initiating the login process via opening a popup window in the user's browser

    Parameters

    Returns Promise<AuthResponse>

    • a promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the AuthResponse object

loginRedirect

  • Use when initiating the login process by redirecting the user's browser to the authorization endpoint.

    Parameters

    Returns void

logout

  • logout(): 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.

    Returns void

Generated using TypeDoc