Skip to content

Commit 867ca95

Browse files
fix: signed in hub event is now fired after currentUser is set, instead of before (#1300)
1 parent 7eb5f0d commit 867ca95

File tree

1 file changed

+9
-8
lines changed

1 file changed

+9
-8
lines changed

aws-auth-cognito/src/main/java/com/amplifyframework/auth/cognito/AWSCognitoAuthPlugin.java

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -198,14 +198,15 @@ public void onResult(UserStateDetails result) {
198198
}
199199
break;
200200
case SIGNED_IN:
201-
fetchAndSetUserId(() -> { /* No response needed */ });
202-
if (lastEvent != AuthChannelEventName.SIGNED_IN) {
203-
lastEvent = AuthChannelEventName.SIGNED_IN;
204-
Amplify.Hub.publish(
205-
HubChannel.AUTH,
206-
HubEvent.create(AuthChannelEventName.SIGNED_IN)
207-
);
208-
}
201+
fetchAndSetUserId(() -> {
202+
if (lastEvent != AuthChannelEventName.SIGNED_IN) {
203+
lastEvent = AuthChannelEventName.SIGNED_IN;
204+
Amplify.Hub.publish(
205+
HubChannel.AUTH,
206+
HubEvent.create(AuthChannelEventName.SIGNED_IN)
207+
);
208+
}
209+
});
209210
break;
210211
case SIGNED_OUT_FEDERATED_TOKENS_INVALID:
211212
case SIGNED_OUT_USER_POOLS_TOKENS_INVALID:

0 commit comments

Comments
 (0)