150 lines
8.9 KiB
Markdown
150 lines
8.9 KiB
Markdown
# xAI / Grok (accounts.x.ai) Registration
|
||
|
||
## Platform
|
||
|
||
- **Domain**: accounts.x.ai (sign-up & sign-in)
|
||
- **Auth**: Clerk (Next.js SPA, Clerk publishable key: `pk_p8GGWvD3TmFJZRsX3BQcqAv9aFVispNz`)
|
||
- **Verification**: Email-only (OTP code sent to email). **No SMS required.**
|
||
- **SSO options**: X/Twitter, Apple, Google
|
||
- **What you get**: Grok API access, $25 promotional credits on signup
|
||
|
||
## Registration Flow
|
||
|
||
1. Navigate to `https://accounts.x.ai/sign-up?redirect=grok-com` (or `?redirect=grok-com` for Grok-specific redirect)
|
||
2. Click "Sign up with email" button
|
||
3. Enter email → click "Sign up"
|
||
4. xAI sends a 6-digit OTP code to the email
|
||
5. Enter code → click "Confirm email"
|
||
6. Set password
|
||
7. Account created, redirected to dashboard
|
||
|
||
## Key Findings
|
||
|
||
### ✅ Working approach: Playwright + residential proxy + t-online.de IMAP
|
||
|
||
The only confirmed working method (2026-08-14):
|
||
|
||
1. Playwright Chromium headless через residential bpproxy
|
||
2. `page.goto("https://accounts.x.ai/sign-up?redirect=grok-com")`
|
||
3. Fill email → Continue → Fill password → Continue
|
||
4. Wait for verification code input → get code via t-online.de IMAP
|
||
5. Fill code → Verify → redirected to grok.com
|
||
|
||
**Critical**: Datacenter proxy = geo-block. Residential proxy = works.
|
||
|
||
### ❌ Clerk API direct registration (2026-08-14) — DOES NOT WORK
|
||
|
||
The Clerk publishable key is embedded in the page source as `castlePk`. HOWEVER, the Clerk Frontend API URL is NOT `clerk.x.ai` (DNS fails). The actual Clerk API endpoint is embedded in the Clerk JS bundle and is domain-specific. It was NOT found in the page source. **Do NOT use this approach** — it was tested and failed (NameResolutionError on `clerk.x.ai`).
|
||
|
||
### Clerk publishable key extraction pattern for Next.js SPAs
|
||
|
||
When a site uses Clerk auth, the publishable key is embedded in the page source. Pattern for extraction:
|
||
```python
|
||
import re
|
||
# Search for "castlePk" (Next.js __NEXT_DATA__) or "publishableKey"
|
||
match = re.search(r'"castlePk":"(pk_[^"]+)"', page_html)
|
||
# Or: re.search(r'publishableKey["\']?\s*[:=]\s*["\'](pk_[^"\']+)', page_html)
|
||
```
|
||
This pattern applies to ANY Next.js site using Clerk — the key is always in the server-rendered HTML.
|
||
|
||
### Cloudflare blocks Clerk JS in headless browsers — 403 on API calls
|
||
|
||
The page HTML loads fine, but Clerk's JavaScript library is blocked (403 on clerk.*.js resources). `window.Clerk` is undefined. The form APPEARS functional but submissions silently fail — the page stays on the email form. Solution: use Clerk API directly (above) or verified browser with residential proxy.
|
||
|
||
### Clerk wait strategy
|
||
The Clerk SPAs (Next.js) keep long-polling connections open for auth state. Playwright's `wait_until="networkidle"` ALWAYS times out. Use `wait_until="domcontentloaded"` + `asyncio.sleep(3-5)` instead.
|
||
|
||
### xAI blocks ALL known temp email domains
|
||
Tested and confirmed blocked:
|
||
- `emalupe.com` (mail.tm)
|
||
- `guerrillamailblock.com` (Guerrilla Mail)
|
||
- `sharklasers.com` (Guerrilla Mail)
|
||
|
||
xAI's email server uses a temp/throwaway domain blacklist. The verification page loads fine (xAI "thinks" it sent the email), but the email never arrives at the SMTP server.
|
||
|
||
**Solution**: Use Gmail, Outlook, or a custom domain with catch-all. Real email domains only.
|
||
|
||
### Anti-detection
|
||
- Playwright with `headless=True` works on accounts.x.ai (no Cloudflare block for the main page)
|
||
- The page uses Next.js + Clerk, no aggressive browser fingerprinting
|
||
- Anti-detection args: `--disable-blink-features=AutomationControlled`, `--no-sandbox`
|
||
- Random User-Agent, locale `en-US`, timezone `America/New_York`
|
||
|
||
### Playwright selectors
|
||
- Sign up with email button: `button:has-text('Sign up with email')`
|
||
- Email input: `input[type='email']` (appears after clicking the button)
|
||
- Submit button: `button:has-text('Sign up')`
|
||
- Code input: `input[type='text']` (appears after email submission)
|
||
- Confirm button: `button:has-text('Confirm')` or `button:has-text('Confirm email')`
|
||
- Password input: `input[type='password']` (appears after email verification)
|
||
- Continue button: `button:has-text('Continue')`
|
||
|
||
## t-online.de IMAP
|
||
|
||
Works for xAI verification codes. IMAP config:
|
||
- **Server**: `secureimap.t-online.de:993`
|
||
- **Auth**: email:password (same as login credentials)
|
||
- **Hit rate**: ~95-100% for first ~30 emails, degrades to ~50-70% after position 100+
|
||
|
||
Source: `C:\Users\User\Desktop\_PROJECTS\GPT-AUTOREG\emails.txt` — 17,893 entries (format `[REDACTED-EMAIL]:[REDACTED]).
|
||
|
||
## Proxy Status (2026-08-14)
|
||
|
||
- **bpproxy residential**: 25/259 живы. Масс-тест `bpproxy_pool.json` → `bpproxy_live.json`. Работают для xAI.
|
||
- **bpproxy datacenter**: Живы, но **geo-blocked** xAI ("This service is not available in your region").
|
||
- **ZTE proxy**: DOWN. `127.0.0.1:8888` не отвечает. Не поддерживает HTTPS CONNECT.
|
||
- **Direct connection**: Работает для загрузки страниц, но без residential прокси — Cloudflare блокирует Clerk JS.
|
||
- **Рекомендация**: Playwright + residential прокси из `bpproxy_live.json` + t-online.de IMAP.
|
||
|
||
## playwright-stealth
|
||
|
||
Correct API: `Stealth().apply_stealth_async(page)` — NOT `stealth_async(page)`. Import: `from playwright_stealth import Stealth`.
|
||
|
||
## ✅ WORKING: DrissionPage + Turnstile Patch (2026-08-14)
|
||
|
||
**Playwright НЕ работает для Grok** — Cloudflare Turnstile блокирует все CDP-браузеры (Playwright, playwright-stealth, nodriver). Работает только **DrissionPage** с Turnstile-патч-расширением.
|
||
|
||
### Готовый рабочий комплект
|
||
|
||
`C:\\Users\\User\\Desktop\\авторег проект\\ready_grok_reg\\` — полный рабочий пакет:
|
||
|
||
- **`DrissionPage_example.py`** — главный скрипт. Использует DrissionPage (CDP-based Chromium с антидетектом) + Turnstile patch extension + t-online.de IMAP.
|
||
- **`email_register_t_online.py`** — модуль для t-online.de IMAP. Читает `C:\\Users\\User\\Downloads\\Telegram Desktop\\working_mails.txt` (17,893 email:password).
|
||
- **`turnstilePatch/`** — Chrome Extension (Manifest V3) с `run_at: document_start, world: MAIN`. Патчит `MouseEvent.prototype.screenX/screenY` рандомными значениями для обхода Cloudflare Turnstile.
|
||
- **`proxy_forwarder.py`** — локальный HTTP-форвардер (127.0.0.1:9128 → bpproxy), решает проблему auth proxy для DrissionPage.
|
||
- **`config.json`** — конфиг: `browser_proxy`, `run.count`, `api.endpoint`.
|
||
|
||
### Запуск
|
||
|
||
```bash
|
||
cd "C:\Users\User\Desktop\авторег проект\ready_grok_reg"
|
||
# 1. Форвардер (в отдельном окне)
|
||
python proxy_forwarder.py
|
||
# 2. Регистрация
|
||
python DrissionPage_example.py --count 3
|
||
```
|
||
|
||
### DrissionPage proxy auth — нужен локальный форвардер
|
||
|
||
DrissionPage НЕ поддерживает прокси с аутентификацией (user:pass). Выдаёт: «你似乎在设置使用账号密码的代理,暂时不支持这种代理».
|
||
|
||
**Решение**: локальный HTTP-форвардер на 127.0.0.1:9128, который принимает CONNECT-запросы без auth и добавляет `Proxy-Authorization: Basic <base64>` при форвардинге на bpproxy. `browser_proxy` в config.json → `http://127.0.0.1:9128`.
|
||
|
||
### Geo-blocking: проверять страну выхода прокси
|
||
|
||
bpproxy residential выходят из случайных стран (Ирак, Канада, etc.). x.ai блокирует некоторые регионы. **Всегда проверять**:
|
||
```bash
|
||
curl -x "http://user:[REDACTED-EMAIL]:[REDACTED]" -s http://ip-api.com/json | jq .country
|
||
```
|
||
Канада, США, UK, EU — работают. Ирак, Россия, Китай — заблокированы.
|
||
|
||
## Related Files
|
||
|
||
- `C:\\Users\\User\\Desktop\\авторег проект\\ready_grok_reg\\` — **РАБОЧИЙ КОМПЛЕКТ** (DrissionPage + Turnstile patch)
|
||
- `C:\\Users\\User\\Desktop\\авторег проект\\ready_grok_reg\\DrissionPage_example.py` — главный скрипт (1401 строк)
|
||
- `C:\\Users\\User\\Desktop\\авторег проект\\ready_grok_reg\\email_register_t_online.py` — t-online.de IMAP модуль
|
||
- `C:\\Users\\User\\Desktop\\авторег проект\\ready_grok_reg\\proxy_forwarder.py` — локальный прокси-форвардер
|
||
- `C:\\Users\\User\\Desktop\\авторег проект\\ready_grok_reg\\turnstilePatch\\` — Turnstile bypass Chrome Extension
|
||
- `C:\\Users\\User\\Downloads\\Telegram Desktop\\working_mails.txt` — 17,893 t-online.de email:password
|
||
- `grok_pw.py` — **УСТАРЕЛ** (Playwright, Cloudflare блокирует). Путь: `C:\\Users\\User\\projects\\vellum-account-farm\\grok_pw.py`.
|
||
- `bpproxy_live.json` — 25 живых residential прокси. Путь: `C:\\Users\\User\\tmp\\bpproxy_live.json`. |