Skip to content

Commit

Permalink
fix(oidc): login async promise (release)
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaume-chervet committed Nov 27, 2024
1 parent 47cbd6f commit 0f69a11
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 10 deletions.
2 changes: 1 addition & 1 deletion packages/oidc-client/src/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const defaultLoginAsync =
extras: StringMap = null,
isSilentSignin = false,
scope: string = undefined,
) => {
): Promise<unknown> => {
const originExtras = extras;
extras = { ...extras };
const loginLocalAsync = async () => {
Expand Down
19 changes: 10 additions & 9 deletions packages/oidc-client/src/oidc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
);
}

loginPromise: Promise<void> = null;
loginPromise: Promise<unknown> = null;
async loginAsync(
callbackPath: string = undefined,
extras: StringMap = null,
Expand All @@ -312,21 +312,22 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
return this.loginPromise;
}
if (silentLoginOnly) {
return defaultSilentLoginAsync(
this.loginPromise = defaultSilentLoginAsync(
window,
this.configurationName,
this.configuration,
this.publishEvent.bind(this),
this,
)(extras, scope);
} else {
this.loginPromise = defaultLoginAsync(
this.configurationName,
this.configuration,
this.publishEvent.bind(this),
this.initAsync.bind(this),
this.location,
)(callbackPath, extras, isSilentSignin, scope);
}
this.loginPromise = defaultLoginAsync(
this.configurationName,
this.configuration,
this.publishEvent.bind(this),
this.initAsync.bind(this),
this.location,
)(callbackPath, extras, isSilentSignin, scope);
return this.loginPromise.finally(() => {
this.loginPromise = null;
});
Expand Down

0 comments on commit 0f69a11

Please sign in to comment.