Skip to content

feat: clear SSO identity on wallet disconnect#46

Open
LautaroPetaccio wants to merge 1 commit intomasterfrom
feat/clear-identity-on-disconnect
Open

feat: clear SSO identity on wallet disconnect#46
LautaroPetaccio wants to merge 1 commit intomasterfrom
feat/clear-identity-on-disconnect

Conversation

@LautaroPetaccio
Copy link
Copy Markdown
Contributor

Summary

  • When a user disconnects their wallet, the auth identity stored by @dcl/single-sign-on-client remains in localStorage. Other Decentraland sites that use decentraland-connect clear this identity on logout so that stale credentials are never reused on reconnect. Without this change, a user who disconnects through core-web3 and reconnects with a different wallet could briefly see the previous identity until useAuthIdentity re-evaluates.
  • This calls localStorageClearIdentity with the current wallet address in the useWallet disconnect callback, before triggering wagmiDisconnect, to stay in sync with the logout behavior of other Decentraland sites.

How it works

  1. The disconnect callback in useWallet now checks if an address exists and, if so, calls localStorageClearIdentity(address) from @dcl/single-sign-on-client before calling wagmiDisconnect().
  2. The identity is cleared before the wagmi disconnect so the address is still available at that point.

Test plan

  • When disconnecting with an address, localStorageClearIdentity is called with that address
  • When disconnecting without an address, localStorageClearIdentity is not called
  • All existing tests continue to pass

When a user disconnects, the auth identity stored by @dcl/single-sign-on-client
remains in localStorage. Other Decentraland sites clear it on logout so that
stale credentials are not reused on reconnect. Without this, a user who
disconnects through core-web3 and reconnects with a different wallet could
briefly see the previous identity until useAuthIdentity re-evaluates.
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build 23925990385

Details

  • 3 of 3 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.05%) to 92.818%

Totals Coverage Status
Change from base Build 23925510988: 0.05%
Covered Lines: 470
Relevant Lines: 497

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants