Skip to content

Configuration ​

Authentication Engines ​

LazyTeams supports two browser automation backends inside lazyteams-auth:

EngineStatusBrowser BackendProfile Directory
chromedpDefaultSystem-installed Chromium-family browser (Chrome, Chromium, Edge, or Brave >= 120) via direct Go CDP — no Node.js driver, no silent downloads~/.config/lazyteams/sessions/chromedp-<browser>/
playwrightOpt-inPlaywright driver + Playwright Firefox cache~/.config/lazyteams/browser-session/

Each engine maintains its own independent, isolated profile. Switching engines never deletes or mixes the other engine's cookies or session state.

Authentication Menu (Ctrl+L) ​

Press Ctrl+L inside the TUI at any time to open the Authentication popup.

Status Header ​

The top of the popup summarizes three independent pieces of state:

  • Engine: the effective engine and where it comes from — e.g. chromedp (default), playwright (prefs), or chromedp (env/cli).
  • Silent renewal: local readiness of the active engine's browser profile, evaluated from non-secret profile structure and metadata only (never reads cookies or tokens, never launches a browser, never contacts Microsoft):
    • Available — an initialized profile exists for the active engine (with valid .meta.json and cookie store for chromedp, or cookies.sqlite for playwright) and no interaction block is active for that engine.
    • Setup required — no saved browser profile exists yet for the active engine. Run Sign in / Re-authenticate (visible browser) once to establish a session.
    • Interaction required — a previous headless renewal hit a Microsoft login, MFA, or Conditional Access prompt on this engine. Run Sign in / Re-authenticate (visible browser) to clear the block.
    • Unknown — incompatible engine/browser combination, missing or mismatched browser executable in .meta.json, or an uninitialized profile directory.
  • Credentials: independent summary of your currently loaded tokens:
    • Ready — Graph, Web, Notif, and EDU credentials are all present.
    • Missing — no active credentials are loaded yet.
    • Partial (<providers> unavailable) — some tokens are available while others are missing, expired, or failed.
    • Interaction required (<providers>) — one or more providers require visible re-authentication.

The Authentication popup provides exactly four options:

  1. Sign in / Re-authenticate (visible browser) Launches lazyteams-auth visibly (--show) for web, notif, edu, and graph using the active engine. Use this on first start, after password/SSO expiry, or whenever Microsoft prompts for MFA or Conditional Access.
  2. Renew tokens silently (headless) Triggers an immediate headless batch renewal (web, notif, edu, graph) reusing the active engine's isolated profile.
  3. Use chromedp engine (default) Saves "auth_engine": "chromedp" in prefs.json (0600) and immediately refreshes Silent renewal for the chromedp profile.
  4. Use Playwright engine (opt-in) Saves "auth_engine": "playwright" in prefs.json (0600) and immediately refreshes Silent renewal for the Playwright profile.

Preferences & Precedence ​

Authentication settings follow a strict four-level precedence order:

CLI flags  >  Environment variables  >  prefs.json  >  Default (chromedp / auto)
SettingCLI flag (temporary)Environment variableprefs.json fieldDefault
Auth engine--engine <chromedp|playwright>LAZYTEAMS_AUTH_ENGINEauth_enginechromedp
Browser choice--browser <auto|chrome|chromium|edge|brave|firefox>LAZYTEAMS_AUTH_BROWSERauth_browserauto
Explicit browser path--browser-path <path>LAZYTEAMS_BROWSER_PATHbrowser_path(empty — auto-discover)

How Each Layer Behaves ​

  • What Ctrl+L saves: Selecting option 3 or 4 in the Ctrl+L menu persists auth_engine in ~/.config/lazyteams/prefs.json.
  • What CLI flags do: Passing --engine, --browser, or --browser-path to lazyteams or lazyteams-auth applies a temporary override for that invocation only. It does not modify prefs.json. There is no CLI flag to persist the auth engine — use Ctrl+L (or edit prefs.json directly) to make a choice persistent.
  • What environment variables do: Setting LAZYTEAMS_AUTH_ENGINE, LAZYTEAMS_AUTH_BROWSER, or LAZYTEAMS_BROWSER_PATH overrides prefs.json for processes in that environment while leaving prefs.json untouched.
  • How to check the active engine:
    • Inside the TUI: press Ctrl+L and check the Engine: line (shows both engine and source: default, prefs, or env/cli).
    • From the terminal: run lazyteams-auth --list-browsers, which prints Config dir, Active engine (with source), Browser choice, discovered Chromium browsers, and Playwright Firefox cache availability.
  • When an override prevails over prefs.json: If you select an engine in Ctrl+L while LAZYTEAMS_AUTH_ENGINE or --engine is active, LazyTeams saves your preference to prefs.json and displays:
    Saved <chosen> preference. Session uses <effective> (override).
    Your saved preference will take effect once you restart without the CLI flag or environment variable override.
  • How to return to chromedp:
    1. Press Ctrl+L and choose Use chromedp engine (default).
    2. If an override is active, unset LAZYTEAMS_AUTH_ENGINE (and LAZYTEAMS_AUTH_BROWSER=firefox if set) and launch lazyteams without --engine playwright.

Config Directory Override ​

Set LAZYTEAMS_CONFIG_DIR to store all runtime files (tokens.env, prefs.json, graph-account, sessions/, browser-session/, and auth-helper.log) in a separate directory. This is useful for keeping isolated profiles (for example, testing a development build alongside a stable profile).

Token System & Automatic Renewal ​

Tokens Managed by lazyteams-auth ​

TokenTypical LifetimeUsageAPIRenewal Behavior
MS_GRAPH_TOKEN~1hChats, teams, channels, presence, filesMicrosoft Graph v1.0Headless via Graph Explorer using account identity; falls back to Ctrl+L on MFA/challenge
TEAMS_WEB_TOKEN~24hRead/write messagesTeams internal API (ChatSvc)Headless via isolated browser profile
TEAMS_NOTIF_TOKEN~24hActivity notificationsTeams internal APIHeadless via isolated browser profile
EDU_TOKEN~1hEducation AssignmentsMicrosoft Education APIHeadless via Assignments OOPIF capture
TEAMS_SPACES_TOKEN~24hTeam/channel creation and external search fallbackTeams beta APIHeadless via isolated browser profile
TEAMS_COOKIE / EDU_COOKIE~24hAuthenticated session headersHTTP HeadersCaptured alongside session tokens
TEAMS_FABRIC_TOKEN(disabled in v0.2.0)Private channel member management (v0.1.x)Fabric APIDisabled in v0.2.0 (Stage 7B closed — not captured or persisted)

Historical note (v0.1.x): Earlier v0.1.x versions documented manual role-change capture for TEAMS_FABRIC_TOKEN. In v0.2.0, Fabric token capture and persistence remain explicitly closed (Stage 7B) until a validated write policy is established.

How Automatic Renewal Works ​

  1. Startup health check & self-healing: When lazyteams starts with saved credentials, it validates tokens in parallel. If any provider returns HTTP 401 Unauthorized, the TUI queues a headless --renew-batch job automatically.
  2. Proactive scheduled renewal: For loaded credentials with an expiration timestamp, the TUI schedules a background headless renewal 5 minutes before expiry.
  3. Reactive HTTP 401 handling: If an active API call returns HTTP 401 during a session, the TUI marks the affected capability expired and dispatches a coordinated headless renewal through the owned lazyteams-auth helper without spawning duplicate helper processes.
  4. Profile reuse & atomic snapshots: The helper reuses the active engine's isolated browser profile (sessions/chromedp-<browser>/ or browser-session/) and streams JSONL events back to the TUI. Captured credentials are validated (including Graph (oid, tid) account/tenant binding against the Teams session) and written atomically to tokens.env (0600) as a new generation snapshot.
  5. Interactive fallback when required: Microsoft may require interactive sign-in, MFA, or Conditional Access verification at any time. When headless renewal detects a challenge, it stops cleanly and emits interaction_required instead of looping or hanging.

What You See in the Top Bar ​

Top Bar IndicatorMeaning
● Not signed in — press [Ctrl+L] to sign inNo session credentials are loaded yet
⠋ Signing in (browser open)...Visible browser login started from Ctrl+L is in progress
⠋ Renewing tokens... / ⠋ Renewing <provider>...Background or manual headless renewal is running
⚠ Sign-in / MFA required — press [Ctrl+L]Headless renewal hit an interactive challenge (MFA, SSO expiry, or Conditional Access); open Ctrl+L → visible browser sign-in
⚠ Token renewal failed (network error) — retry laterTransient network failure prevented renewal; does not require re-login
⚠ Token renewal failed — press [Ctrl+L]Non-network renewal failure; open Ctrl+L or inspect --debug logs

Persistence ​

All runtime files live in ~/.config/lazyteams/ by default (override with LAZYTEAMS_CONFIG_DIR):

PathPurposePermissions
tokens.envCaptured tokens, cookies, and credential generation metadata0600
prefs.jsonPersistent preferences (auth_engine, auth_browser, browser_path, self_chat_ids, download_dir, hidden_teams, hidden_channels, section states, showFileInfo)0600
graph-accountSaved account hint (UPN/email) used as fallback identity for headless Graph renewal0600
sessions/chromedp-<browser>/Isolated chromedp browser user-data directory (chrome, chromium, edge, brave, or custom)0700
sessions/chromedp-<browser>.meta.jsonMetadata pinning the chromedp profile to its engine, browser kind, and canonical executable path0600
sessions/chromedp-<browser>.lockSingle-owner lock file preventing concurrent chromedp helper launches against the same profile0600
browser-session/Isolated Playwright/Firefox profile directory (only created when Playwright is used)0700
browser-session.lockSingle-owner lock file for the Playwright profile0600
auth-helper.logDetailed diagnostic log (written only when --debug is enabled)0600

Do not edit tokens.env manually. Always let lazyteams-auth (via Ctrl+L or CLI) capture and write tokens.env so credential metadata, generation numbers, and 0600 permissions remain intact.

Environment Variables Reference ​

VariableEffect
LAZYTEAMS_CONFIG_DIROverride the base configuration and session directory (default ~/.config/lazyteams)
LAZYTEAMS_AUTH_ENGINEOverride auth engine (chromedp or playwright) over prefs.json
LAZYTEAMS_AUTH_BROWSEROverride browser (auto, chrome, chromium, edge, brave, or firefox) over prefs.json
LAZYTEAMS_BROWSER_PATHOverride explicit browser executable path over prefs.json
PLAYWRIGHT_BROWSERS_PATHCustom Playwright browser cache directory (when using --engine playwright)

Debug Tools ​

Both binaries support --debug for diagnostics:

  • lazyteams --debug: Enables diagnostic mode and propagates --debug to background lazyteams-auth invocations, writing logs to <config-dir>/auth-helper.log.
  • Normal mode: No auth-helper.log is created and helper stdout/stderr does not pollute the terminal.
  • Standalone debugging: Run lazyteams-auth --show --debug (or lazyteams-auth --renew graph --show --debug) to observe browser steps and diagnostic messages directly in the terminal.
  • Browser inspection: Run lazyteams-auth --list-browsers to confirm config dir, active engine, override source, and detected browsers without launching any browser or contacting Microsoft.