Skip to content

Commit 960a694

Browse files
authored
fix(oidc-client): Clear userInfo in storage in clearAsync function (#1603)
When using localStorage as the session storage, the userInfo stays present even after logging out. Due to this and with the recent addition of caching, invalid data gets eventually loaded from the localStorage (as there is no validation on load) and will display wrong information in some cases (e.g. user has switched account on the IdP).
1 parent c781911 commit 960a694

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

packages/oidc-client/src/initSession.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export const initSession = (configurationName, storage = sessionStorage) => {
22
const clearAsync = status => {
33
storage[`oidc.${configurationName}`] = JSON.stringify({ tokens: null, status });
4+
delete storage[`oidc.${configurationName}.userInfo`];
45
return Promise.resolve();
56
};
67

0 commit comments

Comments
 (0)