Skip to content

Basic Authentication Step

BasicAuthStep executes authentication and registration on the server specified by the onboarding Settings.

The iOS equivalent is BasicAuthentication.swift for onboard, restore, and reset methods.

Input Parameters

Mandatory input parameters:

  • onboardingParameters – This setting is provided on the flowContext typically by the WelcomeScreenStep.

  • context – Specifies the android context initiating the flow such as the caller Activity. This setting has to be provided on the initial FlowContext.

Optional Input Parameters:

  • basicAuthStepStore (provided on the step) – Optional store implementation in order to persist the user credentials.

  • authenticator (provided on the step) – Optional custom OKHttp authenticator.

Output Parameters

The output is written into the cookie store and into the optional credential store. In addition, an OKHttp client is created, which can be accessed through the getOkHttpClient method of the OnboardingContext.

Using BasicAuthStep

  1. Set the context and the onboarding settings in the flowContext.

      try {
                OnboardingParameters onboardingParameters = new OnboardingParameters();
       } catch (MalformedURLException e) {
         //error handling
  2. Initiate the step.

      BasicAuthStep basicAuthStep = new BasicAuthStep();
  3. Specify the execute method's FlowActionHandler parameter's "onFailure" and "onSuccess" behavior:

      flowManagerService.execute(flow, flowContext, new FlowActionHandler() {
                public void onFailure(Throwable t) {
                    //set the status, update the caller activity
                public void onSuccess(FlowContext result) {
                    //set the status, update the caller activity
                    //read the result

Behavior of BasicAuthStep

The step sends a post message for the server in order to register the app. If there is no valid session in the cookie store of the device then the step displays the transient UI of the foundation layer. This UI consists of a single dialog box where the end user can enter their username and password required for the server authentication.

After the successful authentication, the session cookies are stored in the cookie store and the registration is executed on the server.

In case of the restore scenario, the OKHttp client is created again without resending the post message and repeating the authentication. The user credentials are used from the cookie store and/or from the persistent storage (application store).

If the incoming flow context already contains a HTTP client, then this step skips the creation of the new OKHttp client.

Relationship to Other Steps

BasicAuthStoreStep uses the output of this step in order to store the user credentials in the application store.

Last update: April 14, 2021