feat: clear SSO identity on wallet disconnect#46
Open
LautaroPetaccio wants to merge 1 commit intomasterfrom
Open
feat: clear SSO identity on wallet disconnect#46LautaroPetaccio wants to merge 1 commit intomasterfrom
LautaroPetaccio wants to merge 1 commit intomasterfrom
Conversation
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.
Pull Request Test Coverage Report for Build 23925990385Details
💛 - Coveralls |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@dcl/single-sign-on-clientremains in localStorage. Other Decentraland sites that usedecentraland-connectclear this identity on logout so that stale credentials are never reused on reconnect. Without this change, a user who disconnects throughcore-web3and reconnects with a different wallet could briefly see the previous identity untiluseAuthIdentityre-evaluates.localStorageClearIdentitywith the current wallet address in theuseWalletdisconnect callback, before triggeringwagmiDisconnect, to stay in sync with the logout behavior of other Decentraland sites.How it works
disconnectcallback inuseWalletnow checks if anaddressexists and, if so, callslocalStorageClearIdentity(address)from@dcl/single-sign-on-clientbefore callingwagmiDisconnect().Test plan
localStorageClearIdentityis called with that addresslocalStorageClearIdentityis not called