Loading

Prevent Salesforce Login from Android Devices or Specific Browsers Using Login Flows

Publiseringsdato: Jun 2, 2026
Beskrivelse

This article explains how to restrict Salesforce access from specific browsers or device types, such as Android browsers. There are two main approaches:

  1. Login Flow approach: Create a Salesforce Login Flow that reads the user agent string at login time and blocks or allows the login attempt based on the detected browser or device. This approach works for browser-based logins.
  2. Connected App restriction approach: For the Salesforce for Android mobile app specifically, you can restrict the Connected App to admin-approved users only, preventing unapproved users from accessing Salesforce via the Android app.

Important prerequisite for the Login Flow approach: The setting "Enable Lightning runtime for flows" in Process Automation Settings must be disabled for the login flow to run correctly.


 

Løsning

Use the steps below to create a Login Flow that reads the user's browser information and blocks access from Android devices. Alternatively, skip to the final section to block the Salesforce Android app via Connected App restrictions.

1. Create a Variable to Store Browser Information

  1. In the Flow Builder, double-click (x) Variable under the CREATE NEW section.
  2. Enter a name in the Name field — for example, LoginFlow_UserAgent.
  3. Enter a description.
  4. Leave the data type as Text.
  5. In the Input/Output Type section, click Input Only.
  6. Click OK.

2. Create a Screen to Display the User's Browser Information

  1. Select the Palette tab.
  2. In the USER INTERFACE section, click the Screen component and drag it to the canvas.
  3. When the configuration menu appears, enter a name — for example, Start Page.
  4. Click Add a field.
  5. From the OUTPUTS section, drag Display Text to the screen.
  6. In the Field Settings tab, enter a Unique Name — for example, Browser_information.
  7. On the Select resource option, click the arrow and select the variable created in Step 1 — for example, LoginFlow_UserAgent.
  8. The variable appears in the format {!LoginFlow_UserAgent}. Add a descriptive message of your choice.

3. Create a Decision to Block or Allow Android Logins

  1. From the LOGIC section on the Palette tab, select and drag the Decision element to the canvas.
  2. Enter a name — for example, Decision page.
  3. Click Add Outcome.
  4. Type Block in the Name field.
  5. Click the arrow next to Select resource and locate the variable from Step 1 — for example, LoginFlow_UserAgent.
  6. In the condition operator, select contains.
  7. In the value field, enter Android.
  8. In the [Default Outcome] field, rename it to Allow.
  9. Click OK.

4. Connect the Flow Logic

  1. From the USER INTERFACE section, drag a new Screen element to the canvas for the block page.
  2. Enter a name — for example, Block Page.
  3. In Navigation Options, configure to Don't show Finish Button.
  4. Add a Display Text field with a custom message — for example: Warning: Salesforce cannot be accessed from an Android browser due to your organization's security policy.
  5. Click OK.

5. Final Steps to Activate the Flow

  1. Set the Start Page (from Step 2) as the starting screen by clicking the green arrow.
  2. Connect the Start Page to the Decision page using the connector arrow.
  3. Connect the Block outcome from the Decision page to the Block Page screen.
  4. Connect the Allow outcome to the end of the flow (or to a redirect screen if needed).
  5. Save the flow.
  6. Apply the flow to the appropriate user profiles via Setup > Login Flows.

To Block the Salesforce for Android App via Connected App

  1. Go to Setup > Manage Apps > Connected Apps > Salesforce/Chatter for Android.
  2. Click Edit.
  3. In the Permitted Users section, select Admin Approved users are pre-authorized.
  4. Remove profiles that should not have access.
  5. Optionally, configure IP restrictions to allow only your company network IPs.
  6. Go to Manage Users > Profiles > select the profile name. Then remove access from the Profile Connected Apps section.
Knowledge-artikkelnummer

000387318

 
Laster
Salesforce Help | Article