Skip to content

Commit

Permalink
fix(oidc): json not valid add warning message (release) (#1258)
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-chervet authored Feb 3, 2024
1 parent 31f295c commit 940ffac
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 6 additions & 0 deletions packages/oidc-client/src/initSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ export const initSession = (configurationName, storage = sessionStorage) => {
};
const getLoginParams = () => {
const dataString = storage[`oidc.login.${configurationName}`];

if(!dataString){
console.warn(`storage[oidc.login.${configurationName}] is empty`);
return null;
}

if (!getLoginParamsCache[configurationName]) {
getLoginParamsCache[configurationName] = JSON.parse(dataString);
}
Expand Down
7 changes: 3 additions & 4 deletions packages/oidc-client/src/oidc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
async tryKeepExistingSessionAsync() :Promise<boolean> {
if (this.tryKeepExistingSessionPromise !== null) {
return this.tryKeepExistingSessionPromise;
}

}
this.tryKeepExistingSessionPromise = tryKeepSessionAsync(this);
return this.tryKeepExistingSessionPromise.then((result) => {
this.tryKeepExistingSessionPromise = null;
Expand Down Expand Up @@ -311,7 +310,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
}
const configuration = this.configuration;

const silentLoginAsync = (extras: StringMap, state:string, scope:string = null) => {
const silentLoginAsync = (extras: StringMap, state:string=null, scope:string = null) => {
return _silentLoginAsync(this.configurationName, this.configuration, this.publishEvent.bind(this))(extras, state, scope);
};
const localsilentLoginAsync = async () => {
Expand All @@ -328,7 +327,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
...loginParams.extras,
...extras,
prompt: 'none',
}, loginParams.state);
});
if (silent_token_response) {
updateTokens(silent_token_response.tokens);
this.publishEvent(Oidc.eventNames.token_renewed, {});
Expand Down

0 comments on commit 940ffac

Please sign in to comment.