Skip to content

Commit 2f2e3ed

Browse files
committed
Add auth hash empty string check
1 parent ec24bed commit 2f2e3ed

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

OneSignalSDK/onesignal/src/main/java/com/onesignal/OneSignal.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1472,7 +1472,7 @@ public static void setEmail(@NonNull final String email, @Nullable final String
14721472
return;
14731473
}
14741474

1475-
if (remoteParams != null && remoteParams.useEmailAuth && emailAuthHash == null) {
1475+
if (remoteParams != null && remoteParams.useEmailAuth && (emailAuthHash == null || emailAuthHash.length() == 0)) {
14761476
String errorMessage = "Email 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.";
14771477
if (callback != null)
14781478
callback.onFailure(new EmailUpdateError(EmailErrorType.REQUIRES_EMAIL_AUTH, errorMessage));
@@ -1572,7 +1572,7 @@ public void run() {
15721572
return;
15731573
}
15741574

1575-
if (remoteParams != null && remoteParams.useUserIdAuth && externalIdAuthHash == null) {
1575+
if (externalId.length() > 0 && remoteParams != null && remoteParams.useUserIdAuth && (externalIdAuthHash == null || externalIdAuthHash.length() == 0)) {
15761576
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.";
15771577
Log(LOG_LEVEL.ERROR, errorMessage);
15781578
return;

0 commit comments

Comments
 (0)