From 51b6cbc1e5393329b835925e6827d47e7b5f9be1 Mon Sep 17 00:00:00 2001 From: Wolfgang Mathurin Date: Mon, 1 Jun 2026 15:02:51 -0700 Subject: [PATCH] Handle test_login_domain with or without https:// prefix TestCredentials now adds https:// if the value is just a hostname. This allows the same test_credentials.json to work on both platforms. --- .../androidsdk/util/test/TestCredentials.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libs/SalesforceSDK/src/com/salesforce/androidsdk/util/test/TestCredentials.java b/libs/SalesforceSDK/src/com/salesforce/androidsdk/util/test/TestCredentials.java index dc56ed062b..1a10700392 100644 --- a/libs/SalesforceSDK/src/com/salesforce/androidsdk/util/test/TestCredentials.java +++ b/libs/SalesforceSDK/src/com/salesforce/androidsdk/util/test/TestCredentials.java @@ -70,7 +70,7 @@ public static void init(Context ctx) { USERNAME = json.getString("username"); ACCOUNT_NAME = json.getString("display_name"); USER_ID = json.getString("user_id"); - LOGIN_URL = json.getString("test_login_domain"); + LOGIN_URL = ensureHttpsPrefix(json.getString("test_login_domain")); INSTANCE_URL = json.getString("instance_url"); API_INSTANCE_URL = JSONObjectHelper.optString(json, "api_instance_url"); COMMUNITY_URL = json.optString("community_url", INSTANCE_URL /* in case the test_credentials.json was obtained for a user / org without community setup */); @@ -94,7 +94,7 @@ public static void init(String creds, Context ctx) { USERNAME = json.getString("username"); ACCOUNT_NAME = json.getString("display_name"); USER_ID = json.getString("user_id"); - LOGIN_URL = json.getString("test_login_domain"); + LOGIN_URL = ensureHttpsPrefix(json.getString("test_login_domain")); INSTANCE_URL = json.getString("instance_url"); COMMUNITY_URL = json.optString("community_url", INSTANCE_URL /* In case the test_credentials.json was obtained for a user/org without community setup */); IDENTITY_URL = json.getString("identity_url"); @@ -108,4 +108,10 @@ public static void init(String creds, Context ctx) { throw new RuntimeException(e); } } + + private static String ensureHttpsPrefix(String url) { + if (url == null) return null; + if (url.startsWith("https://") || url.startsWith("http://")) return url; + return "https://" + url; + } }