Source:
<code>public static void setExternalUserId(@NonNull final String externalId, @Nullable final String externalIdAuthHash, @Nullable final OSExternalUserIdUpdateCompletionHandler completionCallback) { if (shouldLogUserPrivacyConsentErrorMessageForMethodName("setExternalUserId()")) return; Runnable runSetExternalUserId = new Runnable() { @Override public void run() { if (externalId == null) { OneSignal.Log(LOG_LEVEL.WARN, "External id can't be null, set an empty string to remove an external id"); return; } <START> if (remoteParams != null && remoteParams.useEmailAuth && externalIdAuthHash == null) { <END> String errorMessage = "External Id authentication (auth token) is set to REQUIRED for this application. Please provide an auth token from your backend server or change the setting in the OneSignal dashboard."; if (completionCallback != null) completionCallback.onFailure(new ExternalIdError(ExternalIdErrorType.REQUIRES_EXTERNAL_ID_AUTH, errorMessage)); Log(LOG_LEVEL.ERROR, errorMessage); return; } String internalExternalIdAuthHash = externalIdAuthHash; if (internalExternalIdAuthHash != null) internalExternalIdAuthHash = externalIdAuthHash.toLowerCase(); try { OneSignalStateSynchronizer.setExternalUserId(externalId, internalExternalIdAuthHash, completionCallback); } catch (JSONException exception) { String operation = externalId.equals("") ? "remove" : "set"; onesignalLog(LOG_LEVEL.ERROR, "Attempted to " + operation + " external ID but encountered a JSON exception"); exception.printStackTrace(); } } }; if (appContext == null || shouldRunTaskThroughQueue()) { addTaskToQueue(new PendingTaskRunnable(runSetExternalUserId)); return; } runSetExternalUserId.run(); }</code><technical_language>remoteParams.useEmailAuth remoteParams.useUserIdAuth</technical_language>

Target:
public static void setExternalUserId(@NonNull final String externalId, @Nullable final String externalIdAuthHash, @Nullable final OSExternalUserIdUpdateCompletionHandler completionCallback) { if (shouldLogUserPrivacyConsentErrorMessageForMethodName("setExternalUserId()")) return; Runnable runSetExternalUserId = new Runnable() { @Override public void run() { if (externalId == null) { OneSignal.Log(LOG_LEVEL.WARN, "External id can't be null, set an empty string to remove an external id"); return; } if (remoteParams != null && remoteParams.useUserIdAuth && externalIdAuthHash == null) { String errorMessage = "External Id authentication (auth token) is set to REQUIRED for this application. Please provide an auth token from your backend server or change the setting in the OneSignal dashboard."; if (completionCallback != null) completionCallback.onFailure(new ExternalIdError(ExternalIdErrorType.REQUIRES_EXTERNAL_ID_AUTH, errorMessage)); Log(LOG_LEVEL.ERROR, errorMessage); return; } String lowerCaseIdAuthHash = externalIdAuthHash; if (lowerCaseIdAuthHash != null) lowerCaseIdAuthHash = externalIdAuthHash.toLowerCase(); try { OneSignalStateSynchronizer.setExternalUserId(externalId, lowerCaseIdAuthHash, completionCallback); } catch (JSONException exception) { String operation = externalId.equals("") ? "remove" : "set"; onesignalLog(LOG_LEVEL.ERROR, "Attempted to " + operation + " external ID but encountered a JSON exception"); exception.printStackTrace(); } } }; if (appContext == null || shouldRunTaskThroughQueue()) { addTaskToQueue(new PendingTaskRunnable(runSetExternalUserId)); return; } runSetExternalUserId.run(); }