Expose is-logged-in endpoint

Summary: Make it possible to ask whether a user is logged in. This won't tackle token expiration but it's consistent with the internal API we have through the `isLoggedIn` atom.

Reviewed By: lblasa

Differential Revision: D37422274

fbshipit-source-id: 2d3a5e27f5dbbe866d5392403e690faf2f1156b2
This commit is contained in:
Pascal Hartig
2022-06-27 04:42:11 -07:00
committed by Facebook GitHub Bot
parent afc51c00a9
commit 9a72169819
2 changed files with 9 additions and 0 deletions

View File

@@ -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) {