Appetize Docs
HomeDemoUploadPricing
  • Introduction
  • Platform
    • App Management
      • Uploading Apps
        • Android
        • iOS
      • App Dashboard
      • Running Apps
      • App Permissions
    • Device Sandbox
    • Embedding
    • Sharing
    • Session Inactivity Timeout
    • Query Params Reference
  • Features
    • Devices & OS Versions
    • Network Traffic Monitor
    • Debug Logs
    • UI Automation
    • Proxy
    • Language & Locale
    • Mock Location
    • Deep links
    • Launch Params
    • Media
    • Auto-grant Permissions
    • Custom Branding
    • Custom Launch Pages
    • Advanced Features
      • Android
        • ADB tunnel
        • Hide Password Visibility
      • Reserved Devices
  • Account
    • Invite your team
    • Single Sign-On
      • OpenID Connect
      • SAML
      • Azure Active Directory
      • Google Workspace (GSuite)
    • Reporting
      • Session History
      • Usage Summary
  • Infrastructure
    • Configure Network Access
    • Enterprise Hosting Options
  • JavaScript SDK
    • Configuration
    • Automation
      • Device commands
      • Touch interactions
    • API reference
      • Initialization
      • Client
      • Session
      • Types
        • AdbConnectionInfo
        • AppetizeApp
        • AndroidElementAttributes
        • Coordinates
        • DeviceInfo
        • Element
        • ElementBounds
        • IOSAccessibilityElement
        • IOSElementAttributes
        • NetworkRequest
        • NetworkResponse
        • SessionConfig
        • SwipeMove
        • RecordedAction
        • RecordedSwipeAction
        • RecordedKeypressAction
        • RecordedPosition
        • RecordedTapAction
        • RecordedTouchAction
        • UserInteraction
  • Testing
    • Getting Started
    • Writing Tests
    • Running Tests
    • Test Configuration
    • Continuous Integration
    • Record Tests (experimental)
    • Trace Viewer
    • Web Tests on Mobile Browsers
  • REST API
    • Create new app
    • Update existing app
    • Direct file uploads
    • Delete app
    • List apps
    • Usage summary
    • Devices & OS Versions
      • v1
    • IP Blocks
      • v1
  • Guides & Samples
    • Impersonation
    • Automate Sign-in Flow
    • Screenshot Automation
    • Unlock Device
    • Validate Analytics Events
    • Lock Your Device to One App
    • Test Accessibility Font Sizes
    • Common testing scenarios
    • Samples Repository
  • Deprecated
    • Cross-document messages
  • Changelog
  • Additional Support
    • Knowledge Base
    • Support Request
Powered by GitBook
On this page
  • Overview
  • Option 1: Launch Parameters
  • Option 2: AppRecorder (UI Automation)
  1. Guides & Samples

Automate Sign-in Flow

Enhance user satisfaction with automated sign-in using Appetize! Automate the process to save time and reduce friction.

PreviousImpersonationNextScreenshot Automation

Last updated 8 months ago

Overview

Automating the sign-in flow refers to the process of enabling your mobile application to perform the sign-in or authentication process automatically, without requiring manual intervention from the user. Instead of users having to enter their credentials (e.g., username and password) each time they access the app, automation allows the app to handle this process programmatically.

There are a lot of use cases where this could be invaluable e.g. for call center agents, reducing the time to access the right screen can boost productivity and improve customer service.

There are various ways to achieve sign-in automation, but in this document we will focus on our two recommended approaches:

Option 1: Launch Parameters

With launch parameters, developers can pass authentication information as part of the app's URL or via our JavaScript SDK when opening it. The app then extracts the provided credentials and automatically signs the user in.

Pros
Cons

Most seamless experience for users

Requires mobile development work

Preparing your Application:

  • Make use of to pass user credentials (e.g. username/password or authentication token) to your Application.

Example of passing in Username and password
&params={"username":"{the user name}","password":"{the user password}"}

The data will be passed as extras into the intent that launches your app e.g.

val username = intent.getStringExtra("username")
val password = intent.getStringExtra("password")
// Start your authentication flow as usual
signInUser(username: username, password: password)

The data passed will be stored in the shared defaults object e.g.

let username = UserDefaults.standard.string(forKey: "username")
let password = UserDefaults.standard.string(forKey: "password")
// Start your authentication flow as usual
signInUser(username: username, password: password)
https://appetize.io/app/{public_key}?launchUrl=yourapp://signin

Some Additional Considerations:

Determine how you will pass the credentials to the Appetize client and session:

Option 2: AppRecorder (UI Automation)

Using our UI automation functionality, developers can script the steps a user takes during the sign-in process. These steps are then replayed automatically whenever the app is launched, mimicking the user's interactions to achieve sign-in.

Pros
Cons

No development work required to imitate user behavior.

Generally slightly slower and less streamlined compared to Option 1.

For the best stability and to to facilitate the auto sign-in process, ensure your mobile application has all the necessary accessibility identifiers or resource identifiers set for the sign-in elements, such as the username input field, password input field, and sign-in button.

  • Determine how to retrieve the credentials e.g. via inputs on your Launch Page e.g.

<label for="username" class="form-label">Username</label>
<input type="text" class="form-control" id="username" name="username" tabindex="1">
<label for="password" class="form-label">Password</label>
<input type="password" class="form-control" id="password" name="password" tabindex="2">
<a id="start_session" type="submit" tabindex="3">Start New Session</a>
const startSessionButton = document.getElementById('start_session');
const usernameField = document.getElementById('username');
const passwordField = document.getElementById('password');
  • If you have a custom button to start the session, add a function to start the Appetize session

startSessionButton.addEventListener('click', async function(event) {
    if(!window.client) { return; }
    try {
        await window.client.startSession();
    } catch (error) {
        console.error(error);
    }
});
  • Observe any session change events to invoke the automated steps to authenticate the user

client.on("session", async session => {
    console.log('session started!')
    try {
         // Get username and password values
        var username = usernameField.value;
        var password = passwordField.value;
        await login(session, username, password);
    } catch (error) {
        console.error(error);
    }
});

These automated steps are just an example and need to be adjusted to match your actual application

async function login(session, username, password) {
    // type username
     await session.tap({
        element: {
            attributes: {
                // android example
                'resource-id': 'username_field'
            }
        }
    });
    await session.type(username)
    
    // type password
    await session.tap({
        element: {
            attributes: {
                // iOS example
                accessibilityIdentifier: 'password_field'
            }
        }
    });
    await session.type(password)
    
    // tap login button
    await session.tap({ 
        element: { 
            attributes: { 
                text: 'Login' 
            } 
        }
    });
}

Make use of to automatically navigate to the appropriate screen to reduce the time to load e.g. if your app has a welcome screen or an onboarding flow, you could skip that by launching directly into the login screen e.g.

Can also be used in conjunction with our other features such as or to get an even more streamlined experience (especially useful if the apps already have existing support for deep links)

Set up your Launch with our .

Run the automated steps to authenticate the user with the credentials that was provided. See for more samples on how to interact with the session:

For a more complete example on how to automate the sign-in flow with our JavaScript SDK, see our in our .

Deep Links
JavaScript SDK
Touch Interactions
Pass Credentials Launch Page
Sample Repository
Launch Params
Launch Parameters
AppRecorder (UI Automation)
Deep Links
Launch Params