File tree Expand file tree Collapse file tree 2 files changed +12
-16
lines changed Expand file tree Collapse file tree 2 files changed +12
-16
lines changed Original file line number Diff line number Diff line change @@ -18,15 +18,13 @@ export function createHiddenFrame() {
1818export function runIframe ( url : string , options : IFrameOptions ) {
1919 return new Promise < any > ( ( resolve , reject ) => {
2020 let onLoadTimeoutId : any = null
21+ const timeoutMs = ( options . timeout || 10 ) * 1000
2122 const iframe = createHiddenFrame ( )
2223
23- const timeoutSetTimeoutId = setTimeout (
24- ( ) => {
25- reject ( new OIDCClientError ( "Timed out" ) )
26- removeIframe ( )
27- } ,
28- ( options . timeout || 10 ) * 1000 ,
29- )
24+ const timeoutSetTimeoutId = setTimeout ( ( ) => {
25+ reject ( new OIDCClientError ( "Timed out" ) )
26+ removeIframe ( )
27+ } , timeoutMs )
3028
3129 const iframeEventHandler = ( e : MessageEvent ) => {
3230 if ( e . origin !== options . eventOrigin ) return
@@ -60,7 +58,7 @@ export function runIframe(url: string, options: IFrameOptions) {
6058 setTimeout ( ( ) => {
6159 reject ( new OIDCClientError ( "Could not complete silent authentication" , url ) )
6260 removeIframe ( )
63- } , 300 )
61+ } , timeoutMs )
6462
6563 window . addEventListener ( "message" , iframeEventHandler , false )
6664 window . document . body . appendChild ( iframe )
Original file line number Diff line number Diff line change @@ -36,20 +36,18 @@ export function runPopup(url: string, options: PopupOptions) {
3636 window . removeEventListener ( "message" , messageListener )
3737 }
3838
39- timeoutId = setTimeout (
40- ( ) => {
41- clearHandlers ( )
42- reject ( new OIDCClientError ( "Timed out" ) )
43- } ,
44- options . timeout || 60 * 1000 ,
45- )
39+ const timeoutMs = ( options . timeout || 60 ) * 1000
40+ timeoutId = setTimeout ( ( ) => {
41+ clearHandlers ( )
42+ reject ( new OIDCClientError ( "Timed out" ) )
43+ } , timeoutMs )
4644
4745 closeId = setInterval ( ( ) => {
4846 if ( popup ! . closed ) {
4947 clearHandlers ( )
5048 reject ( new InteractionCancelled ( "user closed popup" ) )
5149 }
52- } , 300 )
50+ } , timeoutMs )
5351
5452 window . addEventListener ( "message" , messageListener )
5553
You can’t perform that action at this time.
0 commit comments