Skip to content

Commit 2d9d94e

Browse files
fix: always remove guestIdentityId from keyValueStorage on client-side
1 parent 96eaeca commit 2d9d94e

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

packages/auth/src/providers/cognito/credentialsProvider/IdentityIdStore.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,9 @@ export class DefaultIdentityIdStore implements IdentityIdStore {
8080
} else {
8181
this._primaryIdentityId = identity.id;
8282
// Clear locally stored guest id
83-
if (this._hasGuestIdentityId) {
83+
// On the server-side we use the _hasGuestIdentityId flag to avoid caching issues
84+
const serverside = typeof window === 'undefined';
85+
if (this._hasGuestIdentityId || !serverside) {
8486
this.keyValueStorage.removeItem(this._authKeys.identityId);
8587
this._hasGuestIdentityId = false;
8688
}

0 commit comments

Comments
 (0)