ISingleAccountPublicClientApplication Interface

Definition

An interface that contains list of operations that are available when MSAL is in 'single account' mode.

  • In this mode, one account can be signed-in to the app.

  • If the user wants to acquire a token for another account, the previous account must be signed out first.

When the device is registered as 'shared', this will be the only available PublicClientApplication the app can obtain. The calling app has to support ISingleAccountPublicClientApplication if it is planning to support shared device mode.

In the shared device mode,

  • 'Sign-in' means that the user will be signed in to the device - not just this app.

  • Once an account is 'signed-in', every MSAL app on the device that support shared device mode will be able to retrieve this account, and use them to silently perform API calls.

  • 'Sign-out' means that user will be signed out from the device - every MSAL apps and the default browser.

public interface ISingleAccountPublicClientApplication extends IPublicClientApplication

Inherited Members

Methods

acquireTokenSilent(@NonNull final String[] scopes, @NonNull final String authority)

Perform acquire token silent call. If there is a valid access token in the cache, the sdk will return the access token; If no valid access token exists, the sdk will try to find a refresh token and use the refresh token to get a new access token. If refresh token does not exist or it fails the refresh, exception will be sent back via callback.

acquireTokenSilentAsync(@NonNull final String[] scopes, @NonNull final String authority, @NonNull final SilentAuthenticationCallback callback)

Perform acquire token silent call. If there is a valid access token in the cache, the sdk will return the access token; If no valid access token exists, the sdk will try to find a refresh token and use the refresh token to get a new access token. If refresh token does not exist or it fails the refresh, exception will be sent back via callback.

getCurrentAccount()

Gets the current account and notify if the current account changes. This method must be called whenever the application is resumed or prior to running a scheduled background operation.

getCurrentAccountAsync(final CurrentAccountCallback callback)

Gets the current account and notify if the current account changes. This method must be called whenever the application is resumed or prior to running a scheduled background operation.

signIn(@NonNull final Activity activity, @Nullable final String loginHint, @NonNull final String[] scopes, @NonNull final AuthenticationCallback callback)

Allows a user to sign in to your application with one of their accounts. This method may only be called once: once a user is signed in, they must first be signed out before another user may sign in. If you wish to prompt the existing user for credentials use signInAgain(Activity, String[], Prompt, AuthenticationCallback) or acquireToken(AcquireTokenParameters).

Note: The authority used to make the sign in request will be either the MSAL default: https://login.microsoftonline.com/common or the default authority specified by you in your configuration

signIn(@NonNull final Activity activity, @Nullable final String loginHint, @NonNull final String[] scopes, @Nullable final Prompt prompt, @NonNull final AuthenticationCallback callback)

Allows a user to sign in to your application with one of their accounts. This method may only be called once: once a user is signed in, they must first be signed out before another user may sign in. If you wish to prompt the existing user for credentials use signInAgain(Activity, String[], Prompt, AuthenticationCallback) or acquireToken(AcquireTokenParameters).

Note: The authority used to make the sign in request will be either the MSAL default: https://login.microsoftonline.com/common or the default authority specified by you in your configuration

signInAgain(@NonNull final Activity activity, @NonNull final String[] scopes, @Nullable final Prompt prompt, @NonNull final AuthenticationCallback callback)

Reauthorizes the current account according to the supplied scopes and prompt behavior.

Note: The authority used to make the sign in request will be either the MSAL default: https://login.microsoftonline.com/common or the default authority specified by you in your configuration.

signOut()

Signs out the current the Account and Credentials (tokens). NOTE: If a device is marked as a shared device within broker signout will be device wide.

signOut(@NonNull final SignOutCallback callback)

Signs out the current the Account and Credentials (tokens). NOTE: If a device is marked as a shared device within broker signout will be device wide.

Applies to