public class PublicClientApplication extends java.lang.Object implements IPublicClientApplication, ITokenShare
This is the entry point for developer to create public native applications and make API calls to acquire tokens.
Client ID: The clientID of your application is a unique identifier which can be obtained from the app registration portal.
AuthorityMetadata: A URL indicating a directory that MSAL can use to obtain tokens. In Azure AD it is of the form https://<[nstance]/[tenant], where [instance] is the directory host (e.g. https://login.microsoftonline.com) and [tenant] is an identifier within the directory itself (e.g. a domain associated to the tenant, such as contoso.onmicrosoft.com, or the GUID representing the TenantID property of the directory)
For B2C, it is of the form https://[instance]/tfp/[tenant]/[policy] where instance and tenant are same as Azure AD, and [policy] is a string like signup
MSALPublicClientApplication
provides three constructors allowing the client id to be
set either via AndroidManifest.xml metadata or using constructor parameters.
Similarly, if developer chooses not to use the default authority
https://login.microsoftonline.com, an alternate can also be configured using the manifest,
constructor parameters, or in acquire token calls.
Redirect is auto-generated in the library in the format of msal
Developer MUST have BrowserTabActivity
declared in their manifest, which must
have the correct intent-filter configured. If the wrong scheme and host is provided, the sdk
will fail the PublicClientApplication
creation.
Expected format will be:
<activity android:name="com.microsoft.identity.client.BrowserTabActivity"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="msal<AppClientId>" android:host="auth" /> </intent-filter> </activity>
Other Terminology:
Scopes:Permissions that the developers wants included in the access token received . Not all scopes are guaranteed to be included in the access token returned.
Login Hint: Usually an email, to pass to the service at the beginning of the interactive authentication flow.
Extra Scopes to Consent: Permissions you want the user to consent to in the same authentication flow, but won't be included in the returned access token.
Modifier and Type | Class and Description |
---|---|
static interface |
PublicClientApplication.BrokerDeviceModeCallback
Listener callback for asynchronous loading of MSAL mode retrieval.
|
IPublicClientApplication.ApplicationCreatedListener, IPublicClientApplication.DeviceCodeFlowCallback, IPublicClientApplication.IMultipleAccountApplicationCreatedListener, IPublicClientApplication.ISingleAccountApplicationCreatedListener, IPublicClientApplication.LoadAccountsCallback, IPublicClientApplication.SignedHttpRequestRequestCallback
Modifier and Type | Method and Description |
---|---|
void |
acquireToken(AcquireTokenParameters acquireTokenParameters)
Acquire token interactively, will pop-up webUI.
|
void |
acquireToken(android.app.Activity activity,
java.lang.String[] scopes,
AuthenticationCallback callback)
Acquire token interactively, will pop-up webUI.
|
IAuthenticationResult |
acquireTokenSilent(AcquireTokenSilentParameters acquireTokenSilentParameters)
Perform acquire token silent call.
|
void |
acquireTokenSilentAsync(AcquireTokenSilentParameters acquireTokenSilentParameters)
Perform acquire token silent call.
|
void |
acquireTokenWithDeviceCode(java.lang.String[] scopes,
IPublicClientApplication.DeviceCodeFlowCallback callback)
Perform the Device Code Flow (DCF) protocol to allow a device without input capability to authenticate and get a new access token.
|
static void |
create(android.content.Context context,
java.io.File configFile,
IPublicClientApplication.ApplicationCreatedListener listener)
PublicClientApplication#create(Context, File, ApplicationCreatedListener)
will read the client id and other configuration settings from the specified file. |
static IPublicClientApplication |
create(android.content.Context context,
int configFileResourceId)
PublicClientApplication#create(Context, int, ApplicationCreatedListener)
will read the client id and other configuration settings from the file included in your
application's resources. |
static void |
create(android.content.Context context,
int configFileResourceId,
IPublicClientApplication.ApplicationCreatedListener listener)
PublicClientApplication#create(Context, int, ApplicationCreatedListener) will read
the client id and other configuration settings from the
file included in your application resources. |
static void |
create(android.content.Context context,
java.lang.String clientId,
java.lang.String authority,
java.lang.String redirectUri,
IPublicClientApplication.ApplicationCreatedListener listener)
PublicClientApplication#create(Context, String, String, ApplicationCreatedListener)
allows the client id and authority to be passed instead of providing them through metadata. |
static IMultipleAccountPublicClientApplication |
createMultipleAccountPublicClientApplication(android.content.Context context,
java.io.File configFile)
createMultipleAccountPublicClientApplication(Context, File)
will read the client id and other configuration settings from the
file included in your application resources. |
static void |
createMultipleAccountPublicClientApplication(android.content.Context context,
java.io.File configFile,
IPublicClientApplication.IMultipleAccountApplicationCreatedListener listener)
PublicClientApplication#createMultipleAccountPublicClientApplication(Context, File, IMultipleAccountApplicationCreatedListener)
will read the client id and other configuration settings from the
file included in your application resources. |
static IMultipleAccountPublicClientApplication |
createMultipleAccountPublicClientApplication(android.content.Context context,
int configFileResourceId)
createMultipleAccountPublicClientApplication(Context, int)
will read the client id and other configuration settings from the file included in your
application's resources. |
static void |
createMultipleAccountPublicClientApplication(android.content.Context context,
int configFileResourceId,
IPublicClientApplication.IMultipleAccountApplicationCreatedListener listener)
PublicClientApplication#createMultipleAccountPublicClientApplication(Context, int, IMultipleAccountApplicationCreatedListener)
will read the client id and other configuration settings from the file included in your
application's resources. |
static ISingleAccountPublicClientApplication |
createSingleAccountPublicClientApplication(android.content.Context context,
java.io.File configFile)
createSingleAccountPublicClientApplication(Context, int)
will read the client id and other configuration settings from the file included in your
applications resources. |
static void |
createSingleAccountPublicClientApplication(android.content.Context context,
java.io.File configFile,
IPublicClientApplication.ISingleAccountApplicationCreatedListener listener)
PublicClientApplication#createSingleAccountPublicClientApplication(Context, int, ISingleAccountApplicationCreatedListener)
will read the client id and other configuration settings from the file included in your
application resources. |
static ISingleAccountPublicClientApplication |
createSingleAccountPublicClientApplication(android.content.Context context,
int configFileResourceId)
createSingleAccountPublicClientApplication(Context, int)
will read the client id and other configuration settings from the file included in your
application's resources. |
static void |
createSingleAccountPublicClientApplication(android.content.Context context,
int configFileResourceId,
IPublicClientApplication.ISingleAccountApplicationCreatedListener listener)
PublicClientApplication#createSingleAccountPublicClientApplication(Context, int, ISingleAccountApplicationCreatedListener)
will read the client id and other configuration settings from the file included in your
application's resources. |
java.lang.String |
generateSignedHttpRequest(IAccount account,
PoPAuthenticationScheme popParameters)
Signs the provided
PoPAuthenticationScheme parameters into a JWT on behalf of the
provided IAccount . |
void |
generateSignedHttpRequest(IAccount account,
PoPAuthenticationScheme popParameters,
IPublicClientApplication.SignedHttpRequestRequestCallback callback)
Signs the provided
PoPAuthenticationScheme parameters into a JWT on behalf of the
provided IAccount . |
PublicClientApplicationConfiguration |
getConfiguration()
Returns the PublicClientConfiguration for this instance of PublicClientApplication.
|
java.lang.String |
getMsaFamilyRefreshToken(java.lang.String identifier) |
TokenShareResult |
getMsaFamilyRefreshTokenWithMetadata(java.lang.String identifier) |
java.lang.String |
getOrgIdFamilyRefreshToken(java.lang.String identifier) |
TokenShareResult |
getOrgIdFamilyRefreshTokenWithMetadata(java.lang.String identifier) |
static java.lang.String |
getSdkVersion() |
boolean |
isSharedDevice()
Returns whether the application is being run on a device that is marked as a shared.
|
void |
saveMsaFamilyRefreshToken(java.lang.String refreshToken) |
void |
saveOrgIdFamilyRefreshToken(java.lang.String ssoStateSerializerBlob) |
static void |
showExpectedMsalRedirectUriInfo(android.app.Activity activity)
Presents an activity that includes the package name, signature, redirect URI and manifest entry required for your application
|
public static void create(android.content.Context context, int configFileResourceId, IPublicClientApplication.ApplicationCreatedListener listener)
PublicClientApplication#create(Context, int, ApplicationCreatedListener)
will read
the client id and other configuration settings from the
file included in your application resources.context
- Application's Context
. The sdk requires the application
context to be passed in
PublicClientApplication
. Cannot be null.
Note: The Context
should be the application context
instead of the running activity's context, which could
potentially make the sdk hold a
strong reference to the activity, thus preventing correct
garbage collection and causing bugs.
configFileResourceId
- The resource ID of the raw file containing the JSON
configuration for the PublicClientApplication.
For more information on the schema of the MSAL config json, please see Android app resource overview and MSAL Github Wiki
listener
- a callback to be invoked when the object is successfully created.
Cannot be null.PublicClientApplication#create(Context, File, ApplicationCreatedListener)
,
PublicClientApplication#create(Context, String, String, String, ApplicationCreatedListener)
,
create(Context, int)
public static void create(android.content.Context context, java.io.File configFile, IPublicClientApplication.ApplicationCreatedListener listener)
PublicClientApplication#create(Context, File, ApplicationCreatedListener)
will read the client id and other configuration settings from the specified file.context
- Application's Context
. The sdk requires the application context to
be passed in PublicClientApplication
. Cannot be null.
Note: The Context
should be the application context instead of the
running activity's context, which could potentially make the sdk hold a
strong reference to the activity, thus preventing correct garbage
collection and causing bugs.
configFile
- The file containing the JSON configuration for the PublicClientApplication.
Cannot be null.
For more information on the schema of the MSAL configuration file, please see Android app resource overview and MSAL Github Wiki
listener
- a callback to be invoked when the object is successfully created. Cannot be null.PublicClientApplication#create(Context, int, ApplicationCreatedListener)
,
PublicClientApplication#create(Context, String, String, String, ApplicationCreatedListener)
,
create(Context, int)
public static void create(android.content.Context context, java.lang.String clientId, java.lang.String authority, java.lang.String redirectUri, IPublicClientApplication.ApplicationCreatedListener listener)
PublicClientApplication#create(Context, String, String, ApplicationCreatedListener)
allows the client id and authority to be passed instead of providing them through metadata.context
- Application's Context
. The sdk requires the application context to
be passed in
PublicClientApplication
. Cannot be null.
Note: The Context
should be the application context instead of
an running activity's context, which could potentially make the sdk hold a
strong reference to the activity, thus preventing correct garbage
collection and causing bugs.
clientId
- The application client id. Cannot be null.authority
- The default authority to be used for the authority. If this is null, the default authority will be used.redirectUri
- The redirect URI of the application.listener
- a callback to be invoked when the object is successfully created.
Cannot be null.PublicClientApplication#create(Context, int, ApplicationCreatedListener)
,
PublicClientApplication#create(Context, File, ApplicationCreatedListener)
,
create(Context, int)
public static IPublicClientApplication create(android.content.Context context, int configFileResourceId) throws java.lang.InterruptedException, MsalException
PublicClientApplication#create(Context, int, ApplicationCreatedListener)
will read the client id and other configuration settings from the file included in your
application's resources.context
- Application's Context
. The sdk requires the application
context to be passed in
PublicClientApplication
. Cannot be null.
Note: The Context
should be the application context
instead of the running activity's context, which could
potentially make the sdk hold a
strong reference to the activity, thus preventing correct
garbage collection and causing bugs.
configFileResourceId
- The resource ID of the raw file containing the JSON
configuration for the PublicClientApplication
For more information on the schema of the MSAL config json, please see Android app resource overview and MSAL Github Wiki
java.lang.IllegalStateException
- if this function is invoked on the main thread.java.lang.InterruptedException
MsalException
PublicClientApplication#create(Context, int, ApplicationCreatedListener)
,
PublicClientApplication#create(Context, File, ApplicationCreatedListener)
,
PublicClientApplication#create(Context, String, String, String, ApplicationCreatedListener)
public static void createMultipleAccountPublicClientApplication(android.content.Context context, int configFileResourceId, IPublicClientApplication.IMultipleAccountApplicationCreatedListener listener)
PublicClientApplication#createMultipleAccountPublicClientApplication(Context, int, IMultipleAccountApplicationCreatedListener)
will read the client id and other configuration settings from the file included in your
application's resources.
This function will pass back an MsalClientException
object if it is unable to
return IMultipleAccountPublicClientApplication
.
For example, when the device is marked as 'shared'
(isSharedDevice()
is set to true)
context
- Application's Context
. The sdk requires the application
context to be passed in PublicClientApplication
.
Cannot be null.
Note: The Context
should be the application context
instead of the running activity's context, which could
potentially make the sdk hold a
strong reference to the activity, thus preventing correct
garbage collection and causing bugs.
configFileResourceId
- The resource ID of the raw file containing the JSON
configuration for the PublicClientApplication.
For more information on the schema of the MSAL config json, please see Android app resource overview and MSAL Github Wiki
listener
- a callback to be invoked when the object is successfully created. Cannot be null.PublicClientApplication#createMultipleAccountPublicClientApplication(Context, File, IMultipleAccountApplicationCreatedListener)
,
createMultipleAccountPublicClientApplication(Context, int)
,
createMultipleAccountPublicClientApplication(Context, File)
public static void createMultipleAccountPublicClientApplication(android.content.Context context, java.io.File configFile, IPublicClientApplication.IMultipleAccountApplicationCreatedListener listener)
PublicClientApplication#createMultipleAccountPublicClientApplication(Context, File, IMultipleAccountApplicationCreatedListener)
will read the client id and other configuration settings from the
file included in your application resources.
This function will pass back an MsalClientException
object if it is unable to
return IMultipleAccountPublicClientApplication
. For example, when the device is
marked as 'shared' (isSharedDevice()
is set to true)
context
- Application's Context
. The sdk requires the application context to
be passed in PublicClientApplication
. Cannot be null.
Note: The Context
should be the application context instead of the
running activity's context, which could potentially make the sdk hold a
strong reference to the activity, thus preventing correct garbage
collection and causing bugs.
configFile
- The file containing the JSON configuration for the PublicClientApplication.
Cannot be null.
For more information on the schema of the MSAL config json, please see Android app resource overview and MSAL Github Wiki
listener
- a callback to be invoked when the object is successfully created. Cannot be null.PublicClientApplication#createMultipleAccountPublicClientApplication(Context, int, IMultipleAccountApplicationCreatedListener)
,
createMultipleAccountPublicClientApplication(Context, int)
,
createMultipleAccountPublicClientApplication(Context, File)
public static IMultipleAccountPublicClientApplication createMultipleAccountPublicClientApplication(android.content.Context context, int configFileResourceId) throws MsalException, java.lang.InterruptedException
createMultipleAccountPublicClientApplication(Context, int)
will read the client id and other configuration settings from the file included in your
application's resources.
This function will pass back an MsalClientException
object if it is unable to
return IMultipleAccountPublicClientApplication
. For example, when the device is
marked as 'shared' (isSharedDevice()
is set to true)
context
- Application's Context
. The sdk requires the application
context to be passed in
PublicClientApplication
. Cannot be null.
Note: The Context
should be the application context
instead of the running activity's context, which could
potentially make the sdk hold a
strong reference to the activity, thus preventing correct
garbage collection and causing bugs.
configFileResourceId
- The resource ID of the raw file containing the JSON
configuration for the PublicClientApplication.
For more information on the schema of the MSAL config json, please see Android app resource overview and MSAL Github Wiki
java.lang.IllegalStateException
- if this function is invoked on the main thread.MsalException
java.lang.InterruptedException
PublicClientApplication#createMultipleAccountPublicClientApplication(Context, int, IMultipleAccountApplicationCreatedListener)
,
PublicClientApplication#createMultipleAccountPublicClientApplication(Context, File, IMultipleAccountApplicationCreatedListener)
,
createMultipleAccountPublicClientApplication(Context, File)
public static IMultipleAccountPublicClientApplication createMultipleAccountPublicClientApplication(android.content.Context context, java.io.File configFile) throws java.lang.InterruptedException, MsalException
createMultipleAccountPublicClientApplication(Context, File)
will read the client id and other configuration settings from the
file included in your application resources.
This function will pass back an MsalClientException
object if it is unable
to return IMultipleAccountPublicClientApplication
. For example, when the device is
marked as 'shared' (isSharedDevice()
is set to true)
context
- Application's Context
. The sdk requires the application context
to be passed in PublicClientApplication
. Cannot be null.
Note: The Context
should be the application context instead of
the running activity's context, which could potentially make the sdk hold a
strong reference to the activity, thus preventing correct garbage
collection and causing bugs.
configFile
- The file containing the JSON configuration for the PublicClientApplication.
Cannot be null.
For more information on the schema of the MSAL configuration file, please see Android app resource overview and MSAL Github Wiki
java.lang.IllegalStateException
- if this function is invoked on the main thread.java.lang.InterruptedException
MsalException
PublicClientApplication#createMultipleAccountPublicClientApplication(Context, int, IMultipleAccountApplicationCreatedListener)
,
PublicClientApplication#createMultipleAccountPublicClientApplication(Context, File, IMultipleAccountApplicationCreatedListener)
,
createMultipleAccountPublicClientApplication(Context, int)
public static void createSingleAccountPublicClientApplication(android.content.Context context, int configFileResourceId, IPublicClientApplication.ISingleAccountApplicationCreatedListener listener)
PublicClientApplication#createSingleAccountPublicClientApplication(Context, int, ISingleAccountApplicationCreatedListener)
will read the client id and other configuration settings from the file included in your
application's resources.
This function will pass back an MsalClientException
object if it is unable to
return ISingleAccountApplicationCreatedListener
. For example, AccountMode in
configuration is not set to single.
context
- Application's Context
. The sdk requires the application
context to be passed in PublicClientApplication
.
Cannot be null.
Note: The Context
should be the application context
instead of the running activity's context, which could
potentially make the sdk hold a
strong reference to the activity, thus preventing correct
garbage collection and causing bugs.
configFileResourceId
- The resource ID of the raw file containing the JSON
configuration for the PublicClientApplication.
For more information on the schema of the MSAL config json, please see Android app resource overview and MSAL Github Wiki
listener
- a callback to be invoked when the object is successfully created.
Cannot be null.PublicClientApplication#createSingleAccountPublicClientApplication(Context, File, ISingleAccountApplicationCreatedListener)
,
createSingleAccountPublicClientApplication(Context, int)
,
createSingleAccountPublicClientApplication(Context, File)
public static void createSingleAccountPublicClientApplication(android.content.Context context, java.io.File configFile, IPublicClientApplication.ISingleAccountApplicationCreatedListener listener)
PublicClientApplication#createSingleAccountPublicClientApplication(Context, int, ISingleAccountApplicationCreatedListener)
will read the client id and other configuration settings from the file included in your
application resources.
This function will pass back an MsalClientException
object if it is unable to
return ISingleAccountApplicationCreatedListener
. For example, AccountMode in
configuration is not set to single.
context
- Application's Context
. The sdk requires the application context
to be passed in PublicClientApplication
. Cannot be null.
Note: The Context
should be the application context instead of the
running activity's context, which could potentially make the sdk hold a
strong reference to the activity, thus preventing correct garbage
collection and causing bugs.
configFile
- The file containing the JSON configuration for the PublicClientApplication.
Cannot be null.
For more information on the schema of the MSAL configuration file, please see Android app resource overview and MSAL Github Wiki
listener
- a callback to be invoked when the object is successfully created. Cannot be null.PublicClientApplication#createSingleAccountPublicClientApplication(Context, int, ISingleAccountApplicationCreatedListener)
,
createSingleAccountPublicClientApplication(Context, int)
,
createSingleAccountPublicClientApplication(Context, File)
public static ISingleAccountPublicClientApplication createSingleAccountPublicClientApplication(android.content.Context context, int configFileResourceId) throws java.lang.InterruptedException, MsalException
createSingleAccountPublicClientApplication(Context, int)
will read the client id and other configuration settings from the file included in your
application's resources.
This function will pass back an MsalClientException
object if it is unable
to return ISingleAccountApplicationCreatedListener
. For example, AccountMode in
configuration is not set to single.
context
- Application's Context
. The sdk requires the application
context to be passed in PublicClientApplication
.
Cannot be null.
Note: The Context
should be the application context
instead of the running activity's context, which could
potentially make the sdk hold a strong reference to the activity,
thus preventing correct garbage collection and causing bugs.
configFileResourceId
- The resource ID of the raw file containing the JSON configuration
for the PublicClientApplication.
For more information on the schema of the MSAL config json, please see Android app resource overview and MSAL Github Wiki
java.lang.IllegalStateException
- if this function is invoked on the main thread.java.lang.InterruptedException
MsalException
PublicClientApplication#createSingleAccountPublicClientApplication(Context, File, ISingleAccountApplicationCreatedListener)
,
PublicClientApplication#createSingleAccountPublicClientApplication(Context, int, ISingleAccountApplicationCreatedListener)
,
createSingleAccountPublicClientApplication(Context, File)
public static ISingleAccountPublicClientApplication createSingleAccountPublicClientApplication(android.content.Context context, java.io.File configFile) throws java.lang.InterruptedException, MsalException
createSingleAccountPublicClientApplication(Context, int)
will read the client id and other configuration settings from the file included in your
applications resources.
This function will pass back an MsalClientException
object if it is unable
to return ISingleAccountApplicationCreatedListener
. For example, AccountMode in
configuration is not set to single.
context
- Application's Context
. The sdk requires the application context
to be passed in PublicClientApplication
. Cannot be null.
Note: The Context
should be the application context instead of
the running activity's context, which could potentially make the sdk hold a
strong reference to the activity, thus preventing correct garbage
collection and causing bugs.
configFile
- The file containing the JSON configuration for the PublicClientApplication.
Cannot be null.
For more information on the schema of the MSAL configuration file, please see Android app resource overview and MSAL Github Wiki
java.lang.IllegalStateException
- if this function is invoked on the main thread.java.lang.InterruptedException
MsalException
PublicClientApplication#createSingleAccountPublicClientApplication(Context, File, ISingleAccountApplicationCreatedListener)
,
PublicClientApplication#createSingleAccountPublicClientApplication(Context, int, ISingleAccountApplicationCreatedListener)
,
createSingleAccountPublicClientApplication(Context, int)
public TokenShareResult getOrgIdFamilyRefreshTokenWithMetadata(java.lang.String identifier) throws MsalClientException
ITokenShare
getOrgIdFamilyRefreshTokenWithMetadata
in interface ITokenShare
MsalClientException
public java.lang.String getOrgIdFamilyRefreshToken(java.lang.String identifier) throws MsalClientException
ITokenShare
getOrgIdFamilyRefreshToken
in interface ITokenShare
MsalClientException
public void saveOrgIdFamilyRefreshToken(java.lang.String ssoStateSerializerBlob) throws MsalClientException
ITokenShare
saveOrgIdFamilyRefreshToken
in interface ITokenShare
MsalClientException
public TokenShareResult getMsaFamilyRefreshTokenWithMetadata(java.lang.String identifier) throws MsalClientException
ITokenShare
getMsaFamilyRefreshTokenWithMetadata
in interface ITokenShare
MsalClientException
public java.lang.String getMsaFamilyRefreshToken(java.lang.String identifier) throws MsalClientException
ITokenShare
getMsaFamilyRefreshToken
in interface ITokenShare
MsalClientException
public void saveMsaFamilyRefreshToken(java.lang.String refreshToken) throws MsalClientException
ITokenShare
saveMsaFamilyRefreshToken
in interface ITokenShare
MsalClientException
public static java.lang.String getSdkVersion()
public static void showExpectedMsalRedirectUriInfo(android.app.Activity activity)
activity
- public PublicClientApplicationConfiguration getConfiguration()
IPublicClientApplication
getConfiguration
in interface IPublicClientApplication
public boolean isSharedDevice()
IPublicClientApplication
isSharedDevice
in interface IPublicClientApplication
public java.lang.String generateSignedHttpRequest(IAccount account, PoPAuthenticationScheme popParameters) throws MsalException
IPublicClientApplication
PoPAuthenticationScheme
parameters into a JWT on behalf of the
provided IAccount
.
Important: Use of this API requires setting the minimum_required_broker_protocol_version to "6.0" or higher.
generateSignedHttpRequest
in interface IPublicClientApplication
account
- The account for whom signing shall occur.popParameters
- The input parameters.MsalException
public void generateSignedHttpRequest(IAccount account, PoPAuthenticationScheme popParameters, IPublicClientApplication.SignedHttpRequestRequestCallback callback)
IPublicClientApplication
PoPAuthenticationScheme
parameters into a JWT on behalf of the
provided IAccount
.
Important: Use of this API requires setting the minimum_required_broker_protocol_version to "6.0" or higher.
generateSignedHttpRequest
in interface IPublicClientApplication
account
- The account for whom signing shall occur.popParameters
- The input parameters.callback
- The callback object to receive the result (or error).public void acquireToken(android.app.Activity activity, java.lang.String[] scopes, AuthenticationCallback callback)
IPublicClientApplication
Prompt
is Prompt.SELECT_ACCOUNT
.acquireToken
in interface IPublicClientApplication
activity
- Non-null Activity
that is used as the parent activity for launching the com.microsoft.identity.common.internal.providers.oauth2.AuthorizationActivity
.scopes
- The non-null array of scopes to be requested for the access token.
MSAL always sends the scopes 'openid profile offline_access'. Do not include any of these scopes in the scope parameter.callback
- The AuthenticationCallback
to receive the result back.
1) If user cancels the flow by pressing the device back button, the result will be sent
back via AuthenticationCallback.onCancel()
.
2) If the sdk successfully receives the token back, result will be sent back via
SilentAuthenticationCallback.onSuccess(IAuthenticationResult)
3) All the other errors will be sent back via
SilentAuthenticationCallback.onError(MsalException)
.public void acquireToken(AcquireTokenParameters acquireTokenParameters)
IPublicClientApplication
Prompt
is Prompt.SELECT_ACCOUNT
.
Convey parameters via the AquireTokenParameters object
acquireToken
in interface IPublicClientApplication
public void acquireTokenSilentAsync(AcquireTokenSilentParameters acquireTokenSilentParameters)
IPublicClientApplication
acquireTokenSilentAsync
in interface IPublicClientApplication
public IAuthenticationResult acquireTokenSilent(AcquireTokenSilentParameters acquireTokenSilentParameters) throws java.lang.InterruptedException, MsalException
IPublicClientApplication
acquireTokenSilent
in interface IPublicClientApplication
java.lang.InterruptedException
MsalException
public void acquireTokenWithDeviceCode(java.lang.String[] scopes, IPublicClientApplication.DeviceCodeFlowCallback callback)
IPublicClientApplication
acquireTokenWithDeviceCode
in interface IPublicClientApplication
scopes
- the desired access scopescallback
- callback object used to communicate with the API throughout the protocol