Expo: request a sign-in just in time
Implements the sign-in rule in expo-builder-core. Always source /home/box/expo-builder/env.sh first.
Rules
- Probe before the step, not after it fails:
agent_cli status --json→auth.loggedIn;eas whoami(no--json; exit 1 + "Not logged in" = signed out);gh auth status; connector status. Agent-cli exit7orerror.needsHuman: truecomes here too. Never start a build, tunnel or sim session that will die on auth. Unprobeable steps (Apple, Play) run--non-interactiveto fail fast. - Ask once, in one message, with the reason, bundling only the sign-ins this task certainly needs.
- Resume automatically from the blocked step. If a code expires, offer one fresh code, then stop; don't loop.
- Never ask for a token, password, 2FA code or key in chat: device link, secret-request card, AuthenticateMcpServer, request_box_help or a password-manager fill. The device code and match number are fine in private chat, never a shared channel.
- Memory records which sign-ins exist, never values (e.g. "Expo: device session as
<user>since ; EXPO_TOKEN: not set; GitHub connector: OK; gh: signed out; Expo MCP: not connected"). - Re-prompt only on expiry or revocation (one message); never re-ask at task start.
- Routines never prompt: if signed out, post one "Expo sign-in expired, I'll ask next time you're here" note and skip.
- Sign out on request:
eas logout,gh auth logout, removeEXPO_TOKEN/GH_TOKENsecrets, update memory. Nevercreate-launch logout: it deletes~/.expo/state.jsonand~/.expo/codesigning/for every Expo tool on the box.
Expo device login (the default identity is the owner)
eas login --device --non-interactive
# prints: Open https://expo.dev/oauth/device?user_code=XXXX-XXXX / Code: XXXX-XXXX / … --resume <id>
- Private chat: "To I need to sign in to Expo as you: open , approve code XXXX-XXXX, and send me the number if one appears." Mention the shared box.
- Poll in the background, ≥5 s apart:
eas login --device --non-interactive --resume <id> [--match <n>](verified: first "Approval pending", then "Ask the user for the number shown in their browser"; finish with--match <number>).Approval pending. Retry after N seconds→ keep polling; number requested → ask the owner;Logged in as <user>→ resume;Device login failed (<status>)→ report. - Code lasts
10 minutes. The session (`/.expo/state.json) also coverspnpm expo(SDK 58 tunnel,expo whoami) andcreate-launch`. expo loginhas no device flow;--devicecan't combine with--sso. SSO/2FA on the approval page is [unverified]; for an SSO-only org use request_box_help witheas login --ssoin the box browser. Session lifetime is [unverified], so routines probe first.
Optional hardening: a Developer-role robot user, token via a secret-request card into EXPO_TOKEN (beats the stored session; eas whoami shows "(authenticated using EXPO_TOKEN)"). env -u EXPO_TOKEN … for owner-only steps like Launch store setup. Robot access to EAS Simulator, Launch, Expo MCP is [unverified].
Apple credentials (box-terminal handover, verified)
Apple sign-in, 2FA, team and certificate choices are the owner's, typed at a real box prompt; never by the bot.
- A computerUse task opens
xfce4-terminalmaximized and runs, in the app dir,source /home/box/expo-builder/env.sh && eas credentials:configure-build -p ios -e <profile>(oreas credentials -p ios), stopping at the first Apple prompt. - Hand the box to the owner for Apple ID, 2FA, team and device selection. Tell them up front:
- Bundle-ID registration can fail until they accept a new Apple Developer agreement at developer.apple.com; then rerun.
- eas-cli caches the Apple session in the box user's home directory on the shared box (never print it) and reuses it silently; they can ask you to delete it.
- "Generate a new Apple Distribution Certificate?" is their call (slots are limited).
eas device:listneeds--apple-team-id <id>non-interactively;eas device:createtakes no flags (interactive; Website option gives a URL for the phone).
Sign-in table
| Credential | First step that needs it | Missing when | How to ask |
|---|---|---|---|
| Expo/EAS (owner) | eas init, build*, simulator:*, update*, workflow:*, env:*, fingerprint:compare --build-id, account:usage, pnpm expo start --tunnel (SDK 58), create-launch --json |
eas whoami exit 1; Either log in with eas login or set the EXPO_TOKEN…, An Expo user account is required, WS_TUNNEL_SIGNED_URL … not logged in; create_launch whoami --json exit 1, empty stdout; agent-cli LAUNCH_NOT_AUTHENTICATED |
Device login (above) |
| Expo robot token (optional) | Same, once the owner opts in | The bearer token is invalid |
Secret-request card → EXPO_TOKEN |
| GitHub connector | Repo/PR tools | needsAuth or 401 |
AuthenticateMcpServer |
GitHub on the box (git push, gh) |
First box push (if chosen) | gh auth status exit 1 |
Secret-request card → GH_TOKEN (fine-grained PAT, Contents + Pull requests, allow-listed repos); else background gh auth login --web, then gh auth setup-git (broad repo scope) |
| EAS GitHub app | expo-eas-pr-pipeline triggers |
Workflows never trigger [unverified detection] | Owner installs it on expo.dev; send the link |
Expo MCP (https://mcp.expo.dev/mcp) |
TestFlight/Play crashes, reviews, docs search | needsAuth / 401 |
Owner adds the connector, then AuthenticateMcpServer |
| Expo Launch | expo-launch-app |
As Expo row | Same session; never create-launch login --session |
| Launch browser steps | After the Launch link | No status API | Owner's own browser; the bot never drives it |
| Apple ASC key / Apple ID | First signed iOS build, eas submit -p ios, TestFlight |
--non-interactive fails on credentials |
Box-terminal handover (above), or the owner's own Mac. Brand-new app: offer expo-launch-app |
| Google Play service account | First eas submit -p android |
Missing key | Owner uploads the JSON on expo.dev → Credentials (link); never via chat |
| Store web forms | No-CLI steps | Login page | Password-manager fill, else request_box_help; plain fields via RequestUserForm |
| App runtime secrets, Sentry | First build that needs them | Missing env var | Secret-request card → eas env:set --visibility secret (production ask-first). Never EXPO_PUBLIC_* |
Handling
- Store credentials stay in EAS; the bot never holds
.p8files, keystores or service-account JSON. - Never print
~/.expo/state.json,.env.eas-simulator,remoteConfig, preview-API URLs or~/.config/gh/hosts.yml.webPreviewUrlcarries a session token: private chat only. - Any session on the shared box is usable by the owner's other agents; say so when asking.