Configuration
Authentication Engines
LazyTeams supports two browser automation backends inside lazyteams-auth:
| Engine | Status | Browser Backend | Profile Directory |
|---|---|---|---|
chromedp | Default | System-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>/ |
playwright | Opt-in | Playwright 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), orchromedp (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.jsonand cookie store forchromedp, orcookies.sqliteforplaywright) 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.
Menu Options
The Authentication popup provides exactly four options:
Sign in / Re-authenticate (visible browser)Launcheslazyteams-authvisibly (--show) forweb,notif,edu, andgraphusing the active engine. Use this on first start, after password/SSO expiry, or whenever Microsoft prompts for MFA or Conditional Access.Renew tokens silently (headless)Triggers an immediate headless batch renewal (web,notif,edu,graph) reusing the active engine's isolated profile.Use chromedp engine (default)Saves"auth_engine": "chromedp"inprefs.json(0600) and immediately refreshesSilent renewalfor thechromedpprofile.Use Playwright engine (opt-in)Saves"auth_engine": "playwright"inprefs.json(0600) and immediately refreshesSilent renewalfor the Playwright profile.
Preferences & Precedence
Authentication settings follow a strict four-level precedence order:
CLI flags > Environment variables > prefs.json > Default (chromedp / auto)| Setting | CLI flag (temporary) | Environment variable | prefs.json field | Default |
|---|---|---|---|---|
| Auth engine | --engine <chromedp|playwright> | LAZYTEAMS_AUTH_ENGINE | auth_engine | chromedp |
| Browser choice | --browser <auto|chrome|chromium|edge|brave|firefox> | LAZYTEAMS_AUTH_BROWSER | auth_browser | auto |
| Explicit browser path | --browser-path <path> | LAZYTEAMS_BROWSER_PATH | browser_path | (empty — auto-discover) |
How Each Layer Behaves
- What
Ctrl+Lsaves: Selecting option 3 or 4 in theCtrl+Lmenu persistsauth_enginein~/.config/lazyteams/prefs.json. - What CLI flags do: Passing
--engine,--browser, or--browser-pathtolazyteamsorlazyteams-authapplies a temporary override for that invocation only. It does not modifyprefs.json. There is no CLI flag to persist the auth engine — useCtrl+L(or editprefs.jsondirectly) to make a choice persistent. - What environment variables do: Setting
LAZYTEAMS_AUTH_ENGINE,LAZYTEAMS_AUTH_BROWSER, orLAZYTEAMS_BROWSER_PATHoverridesprefs.jsonfor processes in that environment while leavingprefs.jsonuntouched. - How to check the active engine:
- Inside the TUI: press
Ctrl+Land check theEngine:line (shows both engine and source:default,prefs, orenv/cli). - From the terminal: run
lazyteams-auth --list-browsers, which printsConfig dir,Active engine(with source),Browser choice, discovered Chromium browsers, and Playwright Firefox cache availability.
- Inside the TUI: press
- When an override prevails over
prefs.json: If you select an engine inCtrl+LwhileLAZYTEAMS_AUTH_ENGINEor--engineis active, LazyTeams saves your preference toprefs.jsonand displays:Your saved preference will take effect once you restart without the CLI flag or environment variable override.Saved <chosen> preference. Session uses <effective> (override). - How to return to
chromedp:- Press
Ctrl+Land chooseUse chromedp engine (default). - If an override is active, unset
LAZYTEAMS_AUTH_ENGINE(andLAZYTEAMS_AUTH_BROWSER=firefoxif set) and launchlazyteamswithout--engine playwright.
- Press
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
| Token | Typical Lifetime | Usage | API | Renewal Behavior |
|---|---|---|---|---|
MS_GRAPH_TOKEN | ~1h | Chats, teams, channels, presence, files | Microsoft Graph v1.0 | Headless via Graph Explorer using account identity; falls back to Ctrl+L on MFA/challenge |
TEAMS_WEB_TOKEN | ~24h | Read/write messages | Teams internal API (ChatSvc) | Headless via isolated browser profile |
TEAMS_NOTIF_TOKEN | ~24h | Activity notifications | Teams internal API | Headless via isolated browser profile |
EDU_TOKEN | ~1h | Education Assignments | Microsoft Education API | Headless via Assignments OOPIF capture |
TEAMS_SPACES_TOKEN | ~24h | Team/channel creation and external search fallback | Teams beta API | Headless via isolated browser profile |
TEAMS_COOKIE / EDU_COOKIE | ~24h | Authenticated session headers | HTTP Headers | Captured alongside session tokens |
TEAMS_FABRIC_TOKEN | (disabled in v0.2.0) | Private channel member management (v0.1.x) | Fabric API | Disabled 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. Inv0.2.0, Fabric token capture and persistence remain explicitly closed (Stage 7B) until a validated write policy is established.
How Automatic Renewal Works
- Startup health check & self-healing: When
lazyteamsstarts with saved credentials, it validates tokens in parallel. If any provider returns HTTP401 Unauthorized, the TUI queues a headless--renew-batchjob automatically. - Proactive scheduled renewal: For loaded credentials with an expiration timestamp, the TUI schedules a background headless renewal 5 minutes before expiry.
- Reactive HTTP 401 handling: If an active API call returns HTTP
401during a session, the TUI marks the affected capability expired and dispatches a coordinated headless renewal through the ownedlazyteams-authhelper without spawning duplicate helper processes. - Profile reuse & atomic snapshots: The helper reuses the active engine's isolated browser profile (
sessions/chromedp-<browser>/orbrowser-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 totokens.env(0600) as a new generation snapshot. - 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_requiredinstead of looping or hanging.
What You See in the Top Bar
| Top Bar Indicator | Meaning |
|---|---|
● Not signed in — press [Ctrl+L] to sign in | No 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 later | Transient 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):
| Path | Purpose | Permissions |
|---|---|---|
tokens.env | Captured tokens, cookies, and credential generation metadata | 0600 |
prefs.json | Persistent preferences (auth_engine, auth_browser, browser_path, self_chat_ids, download_dir, hidden_teams, hidden_channels, section states, showFileInfo) | 0600 |
graph-account | Saved account hint (UPN/email) used as fallback identity for headless Graph renewal | 0600 |
sessions/chromedp-<browser>/ | Isolated chromedp browser user-data directory (chrome, chromium, edge, brave, or custom) | 0700 |
sessions/chromedp-<browser>.meta.json | Metadata pinning the chromedp profile to its engine, browser kind, and canonical executable path | 0600 |
sessions/chromedp-<browser>.lock | Single-owner lock file preventing concurrent chromedp helper launches against the same profile | 0600 |
browser-session/ | Isolated Playwright/Firefox profile directory (only created when Playwright is used) | 0700 |
browser-session.lock | Single-owner lock file for the Playwright profile | 0600 |
auth-helper.log | Detailed diagnostic log (written only when --debug is enabled) | 0600 |
Do not edit
tokens.envmanually. Always letlazyteams-auth(viaCtrl+Lor CLI) capture and writetokens.envso credential metadata, generation numbers, and0600permissions remain intact.
Environment Variables Reference
| Variable | Effect |
|---|---|
LAZYTEAMS_CONFIG_DIR | Override the base configuration and session directory (default ~/.config/lazyteams) |
LAZYTEAMS_AUTH_ENGINE | Override auth engine (chromedp or playwright) over prefs.json |
LAZYTEAMS_AUTH_BROWSER | Override browser (auto, chrome, chromium, edge, brave, or firefox) over prefs.json |
LAZYTEAMS_BROWSER_PATH | Override explicit browser executable path over prefs.json |
PLAYWRIGHT_BROWSERS_PATH | Custom Playwright browser cache directory (when using --engine playwright) |
Debug Tools
Both binaries support --debug for diagnostics:
lazyteams --debug: Enables diagnostic mode and propagates--debugto backgroundlazyteams-authinvocations, writing logs to<config-dir>/auth-helper.log.- Normal mode: No
auth-helper.logis created and helper stdout/stderr does not pollute the terminal. - Standalone debugging: Run
lazyteams-auth --show --debug(orlazyteams-auth --renew graph --show --debug) to observe browser steps and diagnostic messages directly in the terminal. - Browser inspection: Run
lazyteams-auth --list-browsersto confirm config dir, active engine, override source, and detected browsers without launching any browser or contacting Microsoft.