Skip to content

Xác thực ​

User đăng nhập Gommo → nhận access_token. App hoặc browser giữ token và gửi kèm mỗi request.

API credentials và bảo mật ​

Quy tắcLý do
Lưu access_token trên server (env, secret manager, session theo user)Token = quyền dùng tài khoản và credit
Không nhúng token lâu dài trong app mobile, bundle browser, repo publicAi có token có thể tiêu credit và gọi API như user
Gửi domain khi login, create, poll, ai/meDomain đăng ký phải khớp signup — Domain đăng ký
Đổi / thu hồi nếu lộDùng công cụ Gommo/dealer; login lại để token mới
GOMMO_ACCESS_TOKEN merchant (register, sendBalances)Chỉ server — không expose ra client

Ví dụ docs dùng $env:TOKEN / %TOKEN% cho rõ. Production dùng tầng auth của bạn, không paste token vào frontend. Sau login, xem Vòng đời request cho job media.

Gommo public API (khuyến nghị) ​

Thao tácURL
LoginPOST https://api.gommo.net/api/apps/go-mmo/auth/login
Đăng ký (merchant, server)POST https://api.gommo.net/api/apps/go-mmo/auth/register
Đổi mật khẩuPOST https://api.gommo.net/api/apps/go-mmo/auth/change-password
Chuyển credit (P2P)POST https://api.gommo.net/api/apps/go-mmo/users/sendBalances
Lịch sử giao dịch (ledger)POST https://api.gommo.net/api/apps/go-mmo/users/paymentsHistory
Thiết bị đăng nhậpPOST https://api.gommo.net/api/v2/devices
Me / creditsPOST https://api.gommo.net/ai/me

Form body: email, password, domain (login); merchant + email, password, phone, domain (register — chỉ server); access_token, domain, current_password, new_password (đổi mật khẩu); access_token, domain, type, value, username, message (chuyển credit); access_token, domain, limit, time_start, time_end, tùy chọn currency_name, source, language (ledger); access_token, domain, action, tùy chọn current_device_id, device_id, device_name, device_info, language (thiết bị đăng nhập); hoặc access_token, domain (me). Header: Authorization: Bearer <token> khi dùng Bearer style.

→ Gommo public API · Đăng ký · Đổi mật khẩu · Chuyển credit · Lịch sử giao dịch · Thiết bị đăng nhập · Ticket hỗ trợ · Chương trình đối tác · Creator Rewards · Quickstart

Playground — auth API test vs Connection

Playground — System → Login API (test) và Register API (test) gọi POST /gateway/auth/login và /gateway/auth/register, hiển thị JSON như worker khác. Không lưu token, không đổi Connection (dùng Connection → Sign in hoặc /vi/signup/ để lưu session). Domain do tenant dealer trên server — không có field trên form. Register cần env merchant trên gateway. Mode A vẫn cần domain trong form khi gọi thẳng Gommo.

Home feed → Nền tảng — Đổi mật khẩu, Chuyển credit, Lịch sử giao dịch, Thiết bị đăng nhập, Ticket hỗ trợ, Chương trình đối tác và Creator Rewards dùng Bearer đã kết nối (xem đổi mật khẩu, chuyển credit, lịch sử giao dịch, thiết bị đăng nhập, ticket hỗ trợ, chương trình đối tác, Creator Rewards).

Domain sai

Field domain trong form là domain đăng ký user trên Gommo (dealer tenant) — không phải api.gommo.net hay v2.api.gommo.net. Phải khớp lúc signup. Không copy domain từ docs. Domain sai → auth fail, credit/billing lệch dealer.

Domain đăng ký ​

NguồnKhi nào dùng
Signup user / docs dealerProduction — mỗi user có domain đăng ký cố định
$env:GOMMO_API_DOMAIN (PowerShell)Script — set trước khi chạy ví dụ
%REGISTRATION_DOMAIN% (curl.exe)curl Windows — set trong shell
Hostname docs + GET /gateway/sitePortal self-host — site-config → domain đăng ký; local mặc định GOMMO_API_DOMAIN

Integrator lưu domain đăng ký theo từng user (từ luồng signup). Không hardcode domain dealer trong app.

Đăng nhập trên site docs ​

Site tài liệu (dev :5173) có luồng tài khoản sẵn:

TrangURL
Đăng nhập/vi/login/
Đăng ký/vi/signup/
Dashboard (sau login)/vi/app/

Sau đăng nhập/đăng ký thành công, trình duyệt chuyển tới /vi/app/ (Tổng quan). Token lưu localStorage key gw_access_token. Profile và credits lấy từ POST /ai/me.

Dán token dev

Trên /vi/login/, tab Bearer token để dán sẵn access_token Gommo (test không cần email/password).

Cursor MCP (Gommo)

Sau đăng nhập, copy token /vi/app/token/ vào Gommo MCP — xem 10 tools và prompt mẫu.

User token ​

Dùng access_token cho mọi Gommo API call.

Domain: gửi domain trong form body — cùng domain đăng ký tài khoản (domain đăng ký — không copy từ docs).

Login direct ​

bash
curl.exe -X POST "https://api.gommo.net/api/apps/go-mmo/auth/login" ^
  -H "Content-Type: application/x-www-form-urlencoded" ^
  -d "[email protected]&password=YOUR_PASSWORD&domain=%REGISTRATION_DOMAIN%"
powershell
$domain = $env:GOMMO_API_DOMAIN; if (-not $domain) { throw 'Set GOMMO_API_DOMAIN to the user registration domain (dealer)' }
$body = "[email protected]&password=YOUR_PASSWORD&domain=$domain"
Invoke-RestMethod -Method POST `
  -Uri "https://api.gommo.net/api/apps/go-mmo/auth/login" `
  -ContentType "application/x-www-form-urlencoded" `
  -Body $body

Response có access_token — lưu làm $TOKEN.

V2 media jobs ​

  • Header: Authorization: Bearer {access_token}
  • Form body: domain, project_id, prompt, …

Platform / chat / audio (form) ​

  • Form field: access_token={token} hoặc Bearer header
  • Form field: domain — domain đăng ký tài khoản

Admin / merchant (chỉ server) ​

/vi/admin/* không dùng Bearer user.

HeaderEnv server
x-admin-key: {ADMIN_API_KEY}ADMIN_API_KEY

→ Admin reference

Kiểm tra session ​

Lấy user và số dư credit. Dashboard docs (/vi/app/) và nạp tiền dùng endpoint này.

bash
curl.exe -X POST "https://api.gommo.net/ai/me" ^
  -H "Content-Type: application/x-www-form-urlencoded" ^
  -d "access_token=%TOKEN%&domain=%REGISTRATION_DOMAIN%"
powershell
$domain = $env:GOMMO_API_DOMAIN; if (-not $domain) { throw 'Set GOMMO_API_DOMAIN to the user registration domain (dealer)' }
$meBody = "access_token=$env:TOKEN&domain=$domain"
Invoke-RestMethod -Method POST `
  -Uri "https://api.gommo.net/ai/me" `
  -ContentType "application/x-www-form-urlencoded" `
  -Body $meBody

Gửi device_id, device_name, và device_info trong form (theo contract Gommo public API) để balancesInfo.credits_ai có giá trị.


Tùy chọn: self-host (operator) ​

Deploy repo (npm run dev, Docker) thêm mount JSON/proxy cho portal, billing, BYOK preview — không thuộc contract tích hợp Gommo public.

→ Deploy → Self-host nâng cao