Class MSQASignInClient


  • public final class MSQASignInClient
    extends java.lang.Object
    This is the entry point for developer to create public native applications and make API calls.
    • Method Detail

      • create

        public static void create​(@NonNull
                                  android.content.Context context,
                                  @NonNull
                                  MSQASignInOptions signInOptions,
                                  @NonNull
                                  ClientCreatedListener listener)
        This function will read the configurations from MSQASignInOptions to create the MSQASignInClient.
        Parameters:
        context - The sdk requires the application context to be passed in MSQASignInClient. Cannot be null.
        signInOptions - A configuration item for client initialization.
        listener - A callback to be invoked when the object is successfully created. Cannot be null.
      • setLogLevel

        public static void setLogLevel​(int logLevel)
        Set the log level for diagnostic purpose. By default, the sdk enables the verbose level logging.
        Parameters:
        logLevel - The LogLevel to be enabled for the diagnostic logging.
      • setEnableLogcatLog

        public static void setEnableLogcatLog​(boolean enableLogcatLog)
        Enable/Disable the Android logcat logging. By default, the sdk disables it.
        Parameters:
        enableLogcatLog - True if enabling the logcat logging, false otherwise.
      • setExternalLogger

        public static void setExternalLogger​(ILogger externalLogger)
        Set the custom logger. Configures external logging to configure a callback that the sdk will use to pass each log message. Overriding the logger callback is not allowed.
        Parameters:
        externalLogger - The reference to the ILoggerCallback that can output the logs to the designated places.
      • signIn

        public void signIn​(@NonNull
                           android.app.Activity activity,
                           @NonNull
                           OnCompleteListener<MSQAAccountInfo> completeListener)
        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.
        Parameters:
        activity - Activity that is used as the parent activity for launching sign in page.
        completeListener - A callback to be invoked when sign in success and will return sign in account info MSQAAccountInfo.
      • signOut

        public void signOut​(@NonNull
                            OnCompleteListener<java.lang.Boolean> completeListener)
        Signs out the current the Account and Credentials (tokens).
        Parameters:
        completeListener - A callback to be invoked when sign out finishes and will return sign out result.
      • getCurrentAccount

        public void getCurrentAccount​(@NonNull
                                      OnCompleteListener<MSQAAccountInfo> completeListener)
        Gets the current account. This method must be called whenever the application is resumed or prior to running a scheduled background operation.
        Parameters:
        completeListener - A callback to be invoked when complete and will return sign in account info MSQAAccountInfo if success
      • acquireToken

        public void acquireToken​(@NonNull
                                 android.app.Activity activity,
                                 @NonNull
                                 java.lang.String[] scopes,
                                 @NonNull
                                 OnCompleteListener<MSQATokenResult> completeListener)
        Acquire token interactively, will pop-up webUI. Interactive flow will skip the cache lookup.
        Parameters:
        activity - Activity that is used as the parent activity for get token.
        scopes - The non-null array of scopes to be requested for the access token, the supported scopes can be found inMSQASignInScopeInternal.
        completeListener - A callback to be invoked when token get finished.
      • acquireTokenSilent

        public void acquireTokenSilent​(@NonNull
                                       java.lang.String[] scopes,
                                       @NonNull
                                       OnCompleteListener<MSQATokenResult> completeListener)
        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:
        scopes - The non-null array of scopes to be requested for the access token, the supported scopes can be found inMSQASignInScopeInternal.
        completeListener - A callback to be invoked when token get finished.