Skip to content

Commit 0f69a11

Browse files
fix(oidc): login async promise (release)
1 parent 47cbd6f commit 0f69a11

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

packages/oidc-client/src/login.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export const defaultLoginAsync =
2525
extras: StringMap = null,
2626
isSilentSignin = false,
2727
scope: string = undefined,
28-
) => {
28+
): Promise<unknown> => {
2929
const originExtras = extras;
3030
extras = { ...extras };
3131
const loginLocalAsync = async () => {

packages/oidc-client/src/oidc.ts

+10-9
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
296296
);
297297
}
298298

299-
loginPromise: Promise<void> = null;
299+
loginPromise: Promise<unknown> = null;
300300
async loginAsync(
301301
callbackPath: string = undefined,
302302
extras: StringMap = null,
@@ -312,21 +312,22 @@ Please checkout that you are using OIDC hook inside a <OidcProvider configuratio
312312
return this.loginPromise;
313313
}
314314
if (silentLoginOnly) {
315-
return defaultSilentLoginAsync(
315+
this.loginPromise = defaultSilentLoginAsync(
316316
window,
317317
this.configurationName,
318318
this.configuration,
319319
this.publishEvent.bind(this),
320320
this,
321321
)(extras, scope);
322+
} else {
323+
this.loginPromise = defaultLoginAsync(
324+
this.configurationName,
325+
this.configuration,
326+
this.publishEvent.bind(this),
327+
this.initAsync.bind(this),
328+
this.location,
329+
)(callbackPath, extras, isSilentSignin, scope);
322330
}
323-
this.loginPromise = defaultLoginAsync(
324-
this.configurationName,
325-
this.configuration,
326-
this.publishEvent.bind(this),
327-
this.initAsync.bind(this),
328-
this.location,
329-
)(callbackPath, extras, isSilentSignin, scope);
330331
return this.loginPromise.finally(() => {
331332
this.loginPromise = null;
332333
});

0 commit comments

Comments
 (0)