diff --git a/desktop/flipper-common/src/server-types.tsx b/desktop/flipper-common/src/server-types.tsx index 323283c3a..a9f1d67f5 100644 --- a/desktop/flipper-common/src/server-types.tsx +++ b/desktop/flipper-common/src/server-types.tsx @@ -302,6 +302,7 @@ export type FlipperServerCommands = { messages: {category: string; message: string}[], ) => Promise; shutdown: () => Promise; + 'is-logged-in': () => Promise; }; export type GraphResponse = { diff --git a/desktop/flipper-server-core/src/FlipperServerImpl.tsx b/desktop/flipper-server-core/src/FlipperServerImpl.tsx index 213e6493c..9b797773c 100644 --- a/desktop/flipper-server-core/src/FlipperServerImpl.tsx +++ b/desktop/flipper-server-core/src/FlipperServerImpl.tsx @@ -481,6 +481,14 @@ export class FlipperServerImpl implements FlipperServer { shutdown: async () => { process.exit(0); }, + 'is-logged-in': async () => { + try { + const token = await this.keytarManager.retrieveToken(SERVICE_FLIPPER); + return !!token; + } catch (e) { + return false; + } + }, }; registerDevice(device: ServerDevice) {