Expand description
grab auth login: a real phone login on weblogin.grab.com, driven over
CDP inside an isolated browser context.
grabcli does not replay or forge the login page’s anti-bot tokens
(reCAPTCHA Enterprise, the x-hydraweb-jwt fingerprint). Instead it opens
food.grab.com/auth/login in a fresh Target.createBrowserContext
context (own cookie jar, shared with no other tab, so nothing else in the
browser can log it out) and lets the real page do its own checks, the way
a person would. grabcli only:
- types the phone number and keeps “Remember me … 60 days” ticked;
- clicks Continue and, if Grab offers a choice, picks ONE challenge (in-app approval or OTP) — this is the only step that sends anything;
- later (same or another process) types the OTP, or waits for the in-app approval;
- lets the page redirect through
food.grab.com/auth/callbackinside the context, reads the context’s cookies withStorage.getCookies, saves them as the session and disposes the context.
The context outlives the process (disposeOnDetach: false); what’s needed
to resume (context/tab ids, expiry, the masked phone) is kept 0600 in
PendingLogin. Sends are rate-limited by SendLog and never retried.
Nothing here prints cookie values, tokens, OTPs or the full phone number.
Structs§
- Pending
Login - State kept between
--phone …and--otp/--poll. No secrets: ids of the isolated context/tab in the browser and a masked phone. - SendLog
- Timestamps of challenge sends, kept separately from the pending login so cancelling a login never resets the limits.
- Start
Opts - Options for
start.
Enums§
- Channel
- Which challenge to ask Grab for.
- Pending
Kind - What the send produced.
- Screen
- Where the weblogin page is, from
PROBE_JS. - Wait
Outcome - Outcome of
wait_for_approval.
Constants§
- LOGIN_
START_ URL - Where the browser login starts (redirects to weblogin.grab.com).
- MAX_
SENDS_ PER_ HOUR - Maximum challenge sends in any rolling hour.
- PENDING_
TTL_ SECS - How long a started login stays resumable. Grab’s codes live ~5 min.
- PROBE_
JS - Read-only probe of the login tab. Returns structure and fixed UI strings
only; the CLI never prints
text. - SEND_
COOLDOWN_ SECS - Minimum gap between two challenge sends.
Functions§
- cancel
grab auth login --cancel: dispose the isolated context, forget the pending login. Send limits are kept.- classify_
screen - dry_
run_ plan - What
--phone …would do, without doing it (--dry-run). - finish_
with_ otp grab auth login --otp <code>: type the code into the waiting page.- mask_
phone +63••••••••12: the country code and the last two digits only.- order_
tracking_ tabs - food.grab.com tabs in the shared browser that poll order tracking. When
the browser’s food session lapses, such a tab gets 401s from
/trackand the page then calls GrabIDoauth2/logout+ food/auth/logout(every ~16 s), which logs the browser out again right after any login there. The isolated login context is immune, but these tabs still breakgrab auth importand normal browsing. grabcli never closes them. - pending_
json - stdout document after
--phone(or a--pollthat is still waiting). - pick_
option - Pick the challenge option to click for
channel, if Grab offers one. - shared_
browser_ tabs - Order-tracking tabs in the shared browser (best-effort; empty if the
browser is unreachable).
/jsoncan still list a tab for a moment after it was closed, so a non-empty answer is re-checked once after a short delay and only tabs seen both times are reported. - split_
phone - Split
+<cc><national>into (cc, national digits). Spaces, dashes, dots and parentheses are ignored; a trunk0is dropped. - start
- Start a login and send exactly ONE challenge. The caller has already
decided a send is wanted (
--phonewithout--dry-run) and that silent refresh failed. - still_
open - Tabs present in both listings.
- tracking_
tab_ warning - wait_
for_ approval grab auth login --poll: wait up totimeoutfor the in-app approval.