diff --git a/src/UserManager.ts b/src/UserManager.ts index 9512a6de2..7ebee4ee0 100644 --- a/src/UserManager.ts +++ b/src/UserManager.ts @@ -229,7 +229,7 @@ export class UserManager extends OidcClient { const user = await this._signin(args, this._iframeNavigator, { startUrl: url, - silentRequestTimeout: this.settings.silentRequestTimeout + silentRequestTimeoutInSeconds: this.settings.silentRequestTimeoutInSeconds }); if (user) { if (user.profile && user.profile.sub) { @@ -294,7 +294,7 @@ export class UserManager extends OidcClient { }; const navResponse = await this._signinStart(args, this._iframeNavigator, { startUrl: url, - silentRequestTimeout: this.settings.silentRequestTimeout + silentRequestTimeoutInSeconds: this.settings.silentRequestTimeoutInSeconds }); try { const signinResponse = await this.processSigninResponse(navResponse.url); diff --git a/src/UserManagerSettings.ts b/src/UserManagerSettings.ts index 2a3154b2d..c50fb7819 100644 --- a/src/UserManagerSettings.ts +++ b/src/UserManagerSettings.ts @@ -21,8 +21,8 @@ export interface UserManagerSettings extends OidcClientSettings { /** The URL for the page containing the code handling the silent renew */ silent_redirect_uri?: string; - /** Number of milliseconds to wait for the silent renew to return before assuming it has failed or timed out (default: 10000) */ - silentRequestTimeout?: number; + /** Number of seconds to wait for the silent renew to return before assuming it has failed or timed out (default: 10) */ + silentRequestTimeoutInSeconds?: number; /** Flag to indicate if there should be an automatic attempt to renew the access token prior to its expiration (default: false) */ automaticSilentRenew?: boolean; validateSubOnSilentRenew?: boolean; @@ -53,7 +53,7 @@ export class UserManagerSettingsStore extends OidcClientSettingsStore { public readonly popupWindowTarget: string | undefined; public readonly silent_redirect_uri: string | undefined; - public readonly silentRequestTimeout: number | undefined; + public readonly silentRequestTimeoutInSeconds: number | undefined; public readonly automaticSilentRenew: boolean; public readonly validateSubOnSilentRenew: boolean; public readonly includeIdTokenInSilentRenew: boolean; @@ -76,7 +76,7 @@ export class UserManagerSettingsStore extends OidcClientSettingsStore { popupWindowFeatures, popupWindowTarget, silent_redirect_uri, - silentRequestTimeout, + silentRequestTimeoutInSeconds, automaticSilentRenew = false, validateSubOnSilentRenew = false, includeIdTokenInSilentRenew = true, @@ -98,7 +98,7 @@ export class UserManagerSettingsStore extends OidcClientSettingsStore { this.popupWindowTarget = popupWindowTarget; this.silent_redirect_uri = silent_redirect_uri; - this.silentRequestTimeout = silentRequestTimeout; + this.silentRequestTimeoutInSeconds = silentRequestTimeoutInSeconds; this.automaticSilentRenew = automaticSilentRenew; this.validateSubOnSilentRenew = validateSubOnSilentRenew; this.includeIdTokenInSilentRenew = includeIdTokenInSilentRenew; diff --git a/src/navigators/IFrameWindow.ts b/src/navigators/IFrameWindow.ts index 296becf3a..67dcb8a00 100644 --- a/src/navigators/IFrameWindow.ts +++ b/src/navigators/IFrameWindow.ts @@ -4,7 +4,7 @@ import { Log } from "../utils"; import { IWindow, NavigatorParams } from "./IWindow"; -const DefaultTimeout = 10000; +const DefaultTimeoutInSeconds = 10; export class IFrameWindow implements IWindow { private _promise: Promise; @@ -44,9 +44,9 @@ export class IFrameWindow implements IWindow { this._error("No _frame, already closed"); } else { - const timeout = params.silentRequestTimeout || DefaultTimeout; - Log.debug("IFrameWindow.navigate: Using timeout of:", timeout); - this._timer = window.setTimeout(this._timeout.bind(this), timeout); + const timeoutInSeconds = params.silentRequestTimeoutInSeconds || DefaultTimeoutInSeconds; + Log.debug("IFrameWindow.navigate: Using timeout of:", timeoutInSeconds); + this._timer = window.setTimeout(this._timeout.bind(this), timeoutInSeconds * 1000); this._frame.src = params.url; } diff --git a/src/navigators/IWindow.ts b/src/navigators/IWindow.ts index d3b83f028..1b97a7ba3 100644 --- a/src/navigators/IWindow.ts +++ b/src/navigators/IWindow.ts @@ -7,7 +7,7 @@ export interface NavigatorParams { startUrl?: string; popupWindowFeatures?: string; popupWindowTarget?: string; - silentRequestTimeout?: number; + silentRequestTimeoutInSeconds?: number; redirectMethod?: "replace" | "assign"; } diff --git a/test/unit/UserManager.test.ts b/test/unit/UserManager.test.ts index 86c5689ec..a83bac493 100644 --- a/test/unit/UserManager.test.ts +++ b/test/unit/UserManager.test.ts @@ -75,7 +75,7 @@ describe("UserManager", () => { settings = { ...settings, - silentRequestTimeout: 123, + silentRequestTimeoutInSeconds: 123, silent_redirect_uri: "http://client/silent_callback" }; subject = new UserManager(settings); @@ -92,7 +92,7 @@ describe("UserManager", () => { await subject.signinSilent(); // assert - expect(navArgs.silentRequestTimeout).toEqual(123); + expect(navArgs.silentRequestTimeoutInSeconds).toEqual(123); }); it("should work when having no User present", async () => { diff --git a/test/unit/UserManagerSettings.test.ts b/test/unit/UserManagerSettings.test.ts index 43c4c5b5e..bb64768cf 100644 --- a/test/unit/UserManagerSettings.test.ts +++ b/test/unit/UserManagerSettings.test.ts @@ -104,11 +104,11 @@ describe("UserManagerSettings", () => { authority: "authority", client_id: "client", redirect_uri: "redirect", - silentRequestTimeout: 123 + silentRequestTimeoutInSeconds: 123 }); // assert - expect(subject.silentRequestTimeout).toEqual(123); + expect(subject.silentRequestTimeoutInSeconds).toEqual(123); }); });