From a8be4436702400f8e096e0dd3d8c578c3ebb1f33 Mon Sep 17 00:00:00 2001 From: Lorenzo Blasa Date: Fri, 20 Oct 2023 04:59:41 -0700 Subject: [PATCH] Fixes an issue whereas token was only obtained if one exists Summary: The token will be generated if one doesn't exist, so always call get token. Reviewed By: antonk52 Differential Revision: D50494884 fbshipit-source-id: b93ba8ab5ba0c8b48766af3b06e8de94944d08e7 --- desktop/app/src/init.tsx | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/desktop/app/src/init.tsx b/desktop/app/src/init.tsx index 80d697ad7..577c77f62 100644 --- a/desktop/app/src/init.tsx +++ b/desktop/app/src/init.tsx @@ -112,19 +112,6 @@ async function getFlipperServer( ); const keytar: KeytarModule | undefined = await getKeytarModule(staticPath); const port = 52342; - /** - * Only attempt to use the auth token if one is available. Otherwise, - * trying to get the auth token will try to generate one if it does not exist. - * At this state, it would be impossible to generate it as our certificates - * may not be available yet. - */ - let token: string | undefined; - if (await hasAuthToken()) { - token = await getAuthToken(); - } - - const searchParams = new URLSearchParams(token ? {token} : {}); - const TCPconnectionURL = new URL(`ws://localhost:${port}?${searchParams}`); async function shutdown(): Promise { console.info('[flipper-server] Attempt to shutdown.'); @@ -173,6 +160,10 @@ async function getFlipperServer( environmentInfo, ); + const token: string = await getAuthToken(); + const searchParams = new URLSearchParams({token}); + const TCPconnectionURL = new URL(`ws://localhost:${port}?${searchParams}`); + const companionEnv = await initCompanionEnv(server); await server.connect(); await readyForIncomingConnections(server, companionEnv);