Skip to content

Commit

Permalink
ss
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-chervet committed Jan 24, 2025
1 parent 75e7632 commit 69f6700
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
14 changes: 12 additions & 2 deletions packages/oidc-client/src/keepSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,12 @@ export const tryKeepSessionAsync = async (oidc: Oidc) => {
oidc.tokens = tokens;
const getLoginParams = serviceWorker.getLoginParams(oidc.configurationName);
// @ts-ignore
oidc.timeoutId = autoRenewTokens(oidc, oidc.tokens.expiresAt, getLoginParams.extras, getLoginParams.scope);
oidc.timeoutId = autoRenewTokens(
oidc,
oidc.tokens.expiresAt,
getLoginParams.extras,
getLoginParams.scope,
);
const sessionState = await serviceWorker.getSessionStateAsync();
// @ts-ignore
await oidc.startCheckSessionAsync(
Expand Down Expand Up @@ -64,7 +69,12 @@ export const tryKeepSessionAsync = async (oidc: Oidc) => {
oidc.tokens = setTokens(tokens, null, configuration.token_renew_mode);
const getLoginParams = session.getLoginParams();
// @ts-ignore
oidc.timeoutId = autoRenewTokens(oidc, oidc.tokens.expiresAt, getLoginParams.extras, getLoginParams.scope);
oidc.timeoutId = autoRenewTokens(
oidc,
oidc.tokens.expiresAt,
getLoginParams.extras,
getLoginParams.scope,
);
const sessionState = await session.getSessionStateAsync();
// @ts-ignore
await oidc.startCheckSessionAsync(
Expand Down
6 changes: 4 additions & 2 deletions packages/oidc-client/src/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,9 +138,11 @@ export const loginCallbackAsync =
state = await session.getStateAsync();
storage = session;
}

if (queryParams.error || queryParams.error_description) {
throw new Error(`Error from OIDC server: ${queryParams.error} - ${queryParams.error_description}`);
throw new Error(
`Error from OIDC server: ${queryParams.error} - ${queryParams.error_description}`,
);
}

if (queryParams.iss && queryParams.iss !== oidcServerConfiguration.issuer) {
Expand Down
12 changes: 9 additions & 3 deletions packages/oidc-client/src/oidc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ export type InternalLoginCallback = {
};

const loginCallbackWithAutoTokensRenewAsync = async (oidc): Promise<LoginCallback> => {
const { parsedTokens, callbackPath, extras, scope } = await oidc.loginCallbackAsync();
const { parsedTokens, callbackPath, extras, scope } = await oidc.loginCallbackAsync();
oidc.timeoutId = autoRenewTokens(oidc, parsedTokens.expiresAt, extras, scope);
return { callbackPath };
};
Expand Down Expand Up @@ -355,7 +355,13 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
await this.userInfoAsync();
}
// @ts-ignore
return { parsedTokens, state: response.state, callbackPath: response.callbackPath, scope: response.scope, extras : response.extras };
return {
parsedTokens,
state: response.state,
callbackPath: response.callbackPath,
scope: response.scope,
extras: response.extras,
};
};
this.loginCallbackPromise = loginCallbackLocalAsync();
return this.loginCallbackPromise.finally(() => {
Expand Down Expand Up @@ -427,7 +433,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
}
timer.clearTimeout(this.timeoutId);
// @ts-ignore

this.renewTokensPromise = renewTokensAndStartTimerAsync(this, true, extras, scope);
return this.renewTokensPromise.finally(() => {
this.renewTokensPromise = null;
Expand Down

0 comments on commit 69f6700

Please sign in to comment.