amplify-js icon indicating copy to clipboard operation
amplify-js copied to clipboard

fix: always remove guestIdentityId from keyValueStorage on client-side

Open adrianjoshua-strutt opened this issue 5 months ago • 0 comments

Description of changes

Using SSR the guest token in the cookies does not get removed on login. This is because storeIdentityId is called on the server-side before it is called on the client-side, thereby setting _hasGuestIdentityId to false and hindering the client-side to remove the cookie in the browser.

We do not always want to remove the guest identity cookie, because we want to prevent unnecessary cookie deletions when switching between identity types or during credential refreshes. (synced about this with @HuiSF - see https://github.com/aws-amplify/amplify-js/issues/13787)

We fix this by

Issue

https://github.com/aws-amplify/amplify-js/issues/14378

Description of how you validated changes

  1. Ran next.js app provided by costumer
  2. Ran react app to validate that it does not break none SSR flows
  3. e2e tests see: https://github.com/aws-amplify/amplify-js/actions/runs/15782549397

Checklist

  • [x] PR description included
  • [x] yarn test passes
  • [x] Unit Tests are changed

Checklist for repo maintainers

  • [x] Verify E2E tests for existing workflows are working as expected or add E2E tests for newly added workflows

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

adrianjoshua-strutt avatar Jun 19 '25 13:06 adrianjoshua-strutt