Skip to content

Commit 8d538e5

Browse files
authored
Merge pull request #5629 from decentraland/fix/sso-validate-identity
hotfix: check if the identity from the SSO is still valid, and regenerat…
2 parents 25325a2 + 764739e commit 8d538e5

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

browser-interface/packages/shared/session/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import { StoredSession } from './types'
99
import { getProvider as getProviderSelector } from './selectors'
1010
import { now } from 'lib/javascript/now'
1111
import { store } from 'shared/store/isolatedStore'
12+
import { isSessionExpired } from 'lib/web3/provider'
1213

1314
/**
1415
* Store a session into the current PersistentStorage
@@ -57,7 +58,7 @@ async function getSessionWithSSOIdentity(sessions: StoredSession[]) {
5758

5859
const ssoIdentity = await SingleSignOn.getIdentity(session.identity.address)
5960

60-
if (!ssoIdentity) {
61+
if (!ssoIdentity || isSessionExpired({ identity: ssoIdentity })) {
6162
return null
6263
}
6364

browser-interface/packages/shared/session/sagas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ async function createAuthIdentity(requestManager: RequestManager, isGuest: boole
321321

322322
const ssoIdentity = await SingleSignOn.getIdentity(address)
323323

324-
if (!ssoIdentity) {
324+
if (!ssoIdentity || isSessionExpired({ identity: ssoIdentity })) {
325325
auth = await Authenticator.initializeAuthChain(address, ephemeral, ephemeralLifespanMinutes, signer)
326326

327327
await SingleSignOn.storeIdentity(address, auth)

0 commit comments

Comments
 (0)