IMultipleAccountPublicClientApplication Interface
public interface IMultipleAccountPublicClientApplication extends IPublicClientApplication
An interface that contains list of operations that are available when MSAL is in 'multiple account' mode.
This mode allows an application to make API calls with more than one accounts.
The application will only be able to retrieve/remove accounts that have been used to acquire token interactively in this application
API calls' scope is limited to 'the calling app'. (i.e. removeAccount() will not remove credentials of the same account in other apps).
This is MSAL's default mode.
Method Summary
Modifier and Type | Method and Description |
---|---|
void |
acquireToken(@NonNull final Activity activity, @NonNull final String[] scopes, @Nullable final String loginHint, @NonNull final AuthenticationCallback callback)
Acquire token interactively, will pop-up webUI. Interactive flow will skip the cache lookup. |
IAuthentication |
acquireTokenSilent(@NonNull final String[] scopes, @NonNull final IAccount account, @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. |
void |
acquireTokenSilentAsync(@NonNull final String[] scopes, @NonNull final IAccount account, @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. |
IAccount |
getAccount(@NonNull final String identifier)
Retrieve the IAccount object matching the identifier. The identifier could be homeAccountIdentifier, localAccountIdentifier or username. |
void |
getAccount(@NonNull final String identifier, @NonNull final GetAccountCallback callback)
Retrieve the IAccount object matching the identifier. The identifier could be homeAccountIdentifier, localAccountIdentifier or username. |
List<IAccount> |
getAccounts()
Returns a List of IAccount objects for which this application has RefreshTokens. |
void |
getAccounts(@NonNull final LoadAccountsCallback callback)
Asynchronously returns a List of IAccount objects for which this application has RefreshTokens. |
boolean |
removeAccount(@Nullable final IAccount account)
Removes the Account and Credentials (tokens) for the supplied IAccount. |
void |
removeAccount(@Nullable final IAccount account, @NonNull final RemoveAccountCallback callback)
Removes the Account and Credentials (tokens) for the supplied IAccount. |
Inherited Members
Method Details
acquireToken
public void acquireToken(@NonNull final Activity activity, @NonNull final String[] scopes, @Nullable final String loginHint, @NonNull final AuthenticationCallback callback)
Acquire token interactively, will pop-up webUI. Interactive flow will skip the cache lookup.
Parameters:
acquireTokenSilent
public IAuthenticationResult acquireTokenSilent(@NonNull final String[] scopes, @NonNull final IAccount account, @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.
Parameters:
IAccount represents the account to silently request tokens for.
acquireTokenSilentAsync
public void acquireTokenSilentAsync(@NonNull final String[] scopes, @NonNull final IAccount account, @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.
Parameters:
IAccount represents the account to silently request tokens for.
SilentAuthenticationCallback that is used to send the result back. The success result will be sent back via onSuccess(final IAuthenticationResult authenticationResult). Failure case will be sent back via { onError(final MsalException exception)
getAccount
public IAccount getAccount(@NonNull final String identifier)
Retrieve the IAccount object matching the identifier. The identifier could be homeAccountIdentifier, localAccountIdentifier or username.
Parameters:
getAccount
public void getAccount(@NonNull final String identifier, @NonNull final GetAccountCallback callback)
Retrieve the IAccount object matching the identifier. The identifier could be homeAccountIdentifier, localAccountIdentifier or username.
Parameters:
getAccounts
public List
Returns a List of IAccount objects for which this application has RefreshTokens.
getAccounts
public void getAccounts(@NonNull final LoadAccountsCallback callback)
Asynchronously returns a List of IAccount objects for which this application has RefreshTokens.
Parameters:
removeAccount
public boolean removeAccount(@Nullable final IAccount account)
Removes the Account and Credentials (tokens) for the supplied IAccount.
Parameters:
Returns:
removeAccount
public void removeAccount(@Nullable final IAccount account, @NonNull final RemoveAccountCallback callback)
Removes the Account and Credentials (tokens) for the supplied IAccount.
Parameters:
Applies to
Azure SDK for Java
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for