PublicClientApplication class
The PublicClientApplication class is the object exposed by the library to perform authentication and authorization functions in Single Page Applications to obtain JWT tokens as described in the OAuth 2.0 Authorization Code Flow with PKCE specification.
Constructors
- PublicClientApplication(Configuration configuration)
-
Creates a new PublicClientApplication.
factory
Properties
- hashCode → int
-
The hash code for this object.
read-onlyinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
read-onlyinherited
Methods
-
acquireTokenPopup(
PopupRequest request) → Future< AuthenticationResult> -
Use when you want to obtain an
access_token
for your API via opening a popup window in the user's browser. -
acquireTokenRedirect(
RedirectRequest request) → Future< void> - Use when you want to obtain an access_token for your API by redirecting the user's browser window to the authorization endpoint.
-
acquireTokenSilent(
SilentRequest request) → Future< AuthenticationResult> - Silently acquire an access token for a given set of scopes.
-
addEventCallback(
EventCallbackFunction callback) → String? - Registers a function to be called when MSAL emits an event.
-
getAccountByHomeId(
String homeAccountId) → AccountInfo? -
Returns the signed in account matching
homeAccountId
(the account object is created at the time of successful login) ornull
when no matching account is found. -
getAccountByLocalId(
String localAccountId) → AccountInfo? -
Returns the signed in account matching
localAccountId
(the account object is created at the time of successful login) ornull
when no matching account is found. -
getAccountByUsername(
String username) → AccountInfo? -
Returns the signed in account matching
username
(the account object is created at the time of successful login) ornull
when no matching account is found. -
getActiveAccount(
) → AccountInfo? - Gets the currently active account.
-
getAllAccounts(
) → List< AccountInfo> - Returns all accounts that MSAL currently has data for (the account object is created at the time of successful login) or empty array when no accounts are found.
-
getLogger(
) → Logger - Returns the logger instance.
-
handleRedirectFuture(
[String? hash]) → Future< AuthenticationResult?> - Event handler function which allows users to fire events after the PublicClientApplication object has loaded during redirect flows.
-
loginPopup(
[PopupRequest? request]) → Future< AuthenticationResult> - Use when initiating the login process via opening a popup window in the user's browser.
-
loginRedirect(
[RedirectRequest? request]) → Future< void> - Use when initiating the login process by redirecting the user's browser to the authorization endpoint.
-
logoutPopup(
[EndSessionPopupRequest? logoutRequest]) → Future< void> - Clears local cache for the current user then opens a popup window prompting the user to sign-out of the server.
-
logoutRedirect(
[EndSessionRequest? logoutRequest]) → Future< void> -
Use to log out the current user, and redirect the user to the
postLogoutRedirectUri
. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
removeEventCallback(
String callbackId) → void - Removes the callback with the provided ID.
-
setActiveAccount(
AccountInfo? account) → void - Sets the account to use as the active account.
-
setLogger(
Logger logger) → void - Replaces the default logger set in configurations with new Logger with new configurations.
- Sets the navigation client.
-
ssoSilent(
SsoSilentRequest request) → Future< AuthenticationResult> - This function uses a hidden iframe to fetch an authorization code from the eSTS.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited