File tree Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Expand file tree Collapse file tree 1 file changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -294,14 +294,18 @@ function App () {
294294 } , [ loadUrl ] ) ;
295295
296296 useEffect ( ( ) => {
297- const queryParams = parseQueryParams ( window . location ) ;
298- const token = queryParams . get ( MWI_AUTH_TOKEN_NAME_FOR_HTTP ) ;
299-
300- if ( token ) {
301- dispatch ( updateAuthStatus ( token ) ) ;
297+ // Send authenticate request only after env config is fetched,
298+ // fixes https://github.com/mathworks/matlab-proxy/issues/37
299+ if ( hasFetchedEnvConfig ) {
300+ const queryParams = parseQueryParams ( window . location ) ;
301+ const token = queryParams . get ( MWI_AUTH_TOKEN_NAME_FOR_HTTP ) ;
302+
303+ if ( token ) {
304+ dispatch ( updateAuthStatus ( token ) ) ;
305+ }
306+ window . history . replaceState ( null , '' , `${ baseUrl } index.html` ) ;
302307 }
303- window . history . replaceState ( null , '' , `${ baseUrl } index.html` ) ;
304- } , [ dispatch , baseUrl ] ) ;
308+ } , [ dispatch , baseUrl , hasFetchedEnvConfig ] ) ;
305309
306310 // Display one of:
307311 // * Confirmation
You can’t perform that action at this time.
0 commit comments