Options
All
  • Public
  • Public/Protected
  • All
Menu

Hierarchy

  • UserAgentApplication

Index

Constructors

constructor

  • Initialize a UserAgentApplication with a given clientId and authority.

    constructor

    Parameters

    • clientId: string

      The clientID of your application, you should get this from the application registration portal.

    • authority: string

      A URL indicating a directory that MSAL can use to obtain tokens.

    • tokenReceivedCallback: tokenReceivedCallback
    • Default value options: object = {}
      • Optional cacheLocation?: string
      • Optional navigateToLoginRequestUrl?: boolean
      • Optional postLogoutRedirectUri?: string
      • Optional redirectUri?: string
      • Optional validateAuthority?: boolean

    Returns UserAgentApplication

Properties

Private _navigateToLoginRequestUrl

_navigateToLoginRequestUrl: boolean = true

Used to redirect the user back to the redirectUri after login. True = redirects user to redirectUri

Private _openedWindows

_openedWindows: Array<Window>

Used to keep track of opened popup windows.

Private _postLogoutredirectUri

_postLogoutredirectUri: string

Used to redirect the user to this location after logout. Defaults to window.location.href.

Private _redirectUri

_redirectUri: string

The redirect URI of the application, this should be same as the value in the application registration portal. Defaults to window.location.href.

Private _requestType

_requestType: string

Used to track the authentication request.

clientId

clientId: string

Client ID assigned to your app by Azure Active Directory.

validateAuthority

validateAuthority: boolean

Used to turn authority validation on/off. When set to true (default), MSAL will compare the application's authority against well-known URLs templates representing well-formed authorities. It is useful when the authority is obtained at run time to prevent MSAL from displaying authentication prompts from malicious pages.

Accessors

authority

  • get authority(): string
  • set authority(val: string): void

cacheLocation

  • get cacheLocation(): string

Methods

acquireTokenPopup

  • acquireTokenPopup(scopes: Array<string>): Promise<string>
  • acquireTokenPopup(scopes: Array<string>, authority: string): Promise<string>
  • acquireTokenPopup(scopes: Array<string>, authority: string, user: User): Promise<string>
  • acquireTokenPopup(scopes: Array<string>, authority: string, user: User, extraQueryParameters: string): Promise<string>
  • Used to acquire an access token for a new user using interactive authentication via a popup Window. To request an id_token, pass the clientId as the only scope in the scopes array.

    Parameters

    • scopes: Array<string>

      Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like 'openid' and 'profile' are sent with every request.

    Returns Promise<string>

    • A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the token or error.
  • Parameters

    • scopes: Array<string>
    • authority: string

    Returns Promise<string>

  • Parameters

    • scopes: Array<string>
    • authority: string
    • user: User

    Returns Promise<string>

  • Parameters

    • scopes: Array<string>
    • authority: string
    • user: User
    • extraQueryParameters: string

    Returns Promise<string>

acquireTokenRedirect

  • acquireTokenRedirect(scopes: Array<string>): void
  • acquireTokenRedirect(scopes: Array<string>, authority: string): void
  • acquireTokenRedirect(scopes: Array<string>, authority: string, user: User): void
  • acquireTokenRedirect(scopes: Array<string>, authority: string, user: User, extraQueryParameters: string): void
  • Used to obtain an access_token by redirecting the user to the authorization endpoint. To renew idToken, clientId should be passed as the only scope in the scopes array.

    Parameters

    • scopes: Array<string>

      Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like 'openid' and 'profile' are sent with every request.

    Returns void

  • Parameters

    • scopes: Array<string>
    • authority: string

    Returns void

  • Parameters

    • scopes: Array<string>
    • authority: string
    • user: User

    Returns void

  • Parameters

    • scopes: Array<string>
    • authority: string
    • user: User
    • extraQueryParameters: string

    Returns void

acquireTokenSilent

  • acquireTokenSilent(scopes: Array<string>, authority?: string, user?: User, extraQueryParameters?: string): Promise<string>
  • Used to get the token from cache. MSAL will return the cached token if it is not expired. Or it will send a request to the STS to obtain an access_token using a hidden iframe. To renew idToken, clientId should be passed as the only scope in the scopes array.

    Parameters

    • scopes: Array<string>

      Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token. Scopes like 'openid' and 'profile' are sent with every request.

    • Optional authority: string

      A URL indicating a directory that MSAL can use to obtain tokens.

    • Optional user: User

      The user for which the scopes are requested.The default user is the logged in user.

    • Optional extraQueryParameters: string

      Key-value pairs to pass to the STS during the authentication flow.

    Returns Promise<string>

    • A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Resolved with token or rejected with error.

getAllUsers

  • getAllUsers(): Array<User>

getUser

loginPopup

  • loginPopup(scopes: Array<string>, extraQueryParameters?: string): Promise<string>
  • Initiate the login process by opening a popup window.

    Parameters

    • scopes: Array<string>

      Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token returned.

    • Optional extraQueryParameters: string

      Key-value pairs to pass to the STS during the interactive authentication flow.

    Returns Promise<string>

    • A Promise that is fulfilled when this function has completed, or rejected if an error was raised. Returns the token or error.

loginRedirect

  • loginRedirect(scopes?: Array<string>, extraQueryParameters?: string): void
  • Initiate the login process by redirecting the user to the STS authorization endpoint.

    Parameters

    • Optional scopes: Array<string>

      Permissions you want included in the access token. Not all scopes are guaranteed to be included in the access token returned.

    • Optional extraQueryParameters: string

      Key-value pairs to pass to the authentication server during the interactive authentication flow.

    Returns void

logout

  • logout(): void
  • Used to log out the current user, and redirect the user to the postLogoutRedirectUri. Defaults behaviour is to redirect the user to window.location.href.

    Returns void

Generated using TypeDoc