Skip to content

Commit bd1525f

Browse files
committed
[MOB-4068] - Reset jwtToken when logging out
For JWT enabled projects using Android SDK, a logout and login ends up disabling the user but not registering the user again(stopping them from getting push notification). Reason being the auth not reset because the authHandler kept returning the same authtoken and was not set again. Instead it should be set to null and then next time user logs in, the code can continue normally
1 parent 0cd9e12 commit bd1525f

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

iterableapi/src/main/java/com/iterable/iterableapi/IterableApi.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,12 @@ public String getDeviceId() {
11391139
public Context getContext() {
11401140
return _applicationContext;
11411141
}
1142+
1143+
@Override
1144+
public void resetAuth() {
1145+
IterableLogger.d(TAG, "Resetting authToken");
1146+
_authToken = null;
1147+
}
11421148
}
11431149

11441150
//---------------------------------------------------------------------------------------

iterableapi/src/main/java/com/iterable/iterableapi/IterableApiClient.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ interface AuthProvider {
3333
String getDeviceId();
3434
@Nullable
3535
Context getContext();
36+
37+
void resetAuth();
3638
}
3739

3840
IterableApiClient(@NonNull AuthProvider authProvider) {
@@ -559,5 +561,6 @@ void sendGetRequest(@NonNull String resourcePath, @NonNull JSONObject json, @Nul
559561

560562
void onLogout() {
561563
getRequestProcessor().onLogout(authProvider.getContext());
564+
authProvider.resetAuth();
562565
}
563566
}

0 commit comments

Comments
 (0)