Skip to content

Desktop app account login and protected feature examples

Copy the generated connection function for your language first, then adapt these snippets to your project. Read email and password from your login UI and replace export with a real policy feature. Each snippet shows one operation; keep one client alive throughout the application and close it on exit.

Go
Go
app, err := connectLaunch()
if err != nil { return err }
defer app.Close()
if _, err := app.Login(ctx, email, password); err != nil { return err }
return app.RunFeature("export", func() error {
    return exportReport()
})
Python
Python
with connect_launch() as app:
    app.login(email, password)
    result = app.run_feature("export", export_report)
C# / .NET
C# / .NET
await using var app = LaunchConnection.Open();
await app.Login(email, password);
await app.RunFeature("export", async () => {
    await ExportReport();
});
Java
Java
try (var app = LaunchConnection.open()) {
    app.login(email, passwordChars);
    app.runFeature("export", () -> exportReport());
}
JavaScript / Node.js / TypeScript
JavaScript / Node.js / TypeScript
const app = connectLaunch();
try {
  await app.login(email, password);
  const result = await app.runFeature('export', () => exportReport());
} finally {
  await app.close();
}
Rust
Rust
let mut app = connect_launch()?;
app.login(&email, &password)?;
let result = app.run_feature("export", || {
    export_report()?;
    Ok(())
})?;
app.close();
Ruby
Ruby
app = connect_launch
begin
  app.login(email, password)
  result = app.run_feature('export') { export_report }
ensure
  app.close
end
C
C
static int export_action(void *context) {
    return export_report(context); /* Return 1 only on success. */
}

launch_application *app = connect_launch();
if (!app) return 0;
int ok = launch_application_login(app, email, password);
if (ok) ok = launch_application_run_feature(app, "export", export_action, context);
/* Check launch_application_error(app) on failure; never log credentials. */
launch_application_close(app);
return ok;
C++
C++
auto app = connectLaunch();
app.Login(email.c_str(), password.c_str());
app.RunFeature("export", [&] { exportReport(); });

Go ctx must last for the application lifecycle. Java passwords use char[]. C feature callbacks return 1 only on business success. Run the SDK in the Node.js / Electron main process or a trusted backend, and keep network operations off the UI thread.