การยืนยันตัวตน
ผู้ใช้ login Gommo แล้วได้ access_token แอปหรือเบราว์เซอร์เก็บ token และส่งในทุกคำขอ
API credentials และความปลอดภัย
| กฎ | เหตุผล |
|---|---|
เก็บ access_token บนเซิร์ฟเวอร์ (env, secret manager, session ต่อ user) | Token เท่ากับการเข้าถึงบัญชีและเครดิต |
| ไม่ใส่ token ระยะยาวในแอปมือถือ bundle เบราว์เซอร์ หรือ repo สาธารณะ | ใครมี token ใช้เครดิตและเรียก API แทน user ได้ |
ส่ง domain ตอน login create poll ai/me | โดเมนลงทะเบียนต้องตรง signup — โดเมนลงทะเบียน |
| หมุน/ยกเลิกถ้ารั่ว | ใช้เครื่องมือ Gommo/dealer login ใหม่เพื่อ token ใหม่ |
GOMMO_ACCESS_TOKEN merchant (register, sendBalances) | เฉพาะ server — ไม่เปิดให้ client |
ตัวอย่างใน docs ใช้ $env:TOKEN / %TOKEN% เพื่อความชัด Production ใช้ชั้น auth ของคุณ หลัง login ดู วงจร request สำหรับงานมีเดีย
Gommo public API (แนะนำ)
| การดำเนินการ | URL |
|---|---|
| Login | POST https://api.gommo.net/api/apps/go-mmo/auth/login |
| สมัคร (merchant, server) | POST https://api.gommo.net/api/apps/go-mmo/auth/register |
| เปลี่ยนรหัสผ่าน | POST https://api.gommo.net/api/apps/go-mmo/auth/change-password |
| โอน credit (P2P) | POST https://api.gommo.net/api/apps/go-mmo/users/sendBalances |
| ประวัติธุรกรรม (ledger) | POST https://api.gommo.net/api/apps/go-mmo/users/paymentsHistory |
| อุปกรณ์เซสชัน | POST https://api.gommo.net/api/v2/devices |
| Me / credits | POST https://api.gommo.net/ai/me |
Form body: email, password, domain (login); merchant + email, password, phone, domain (register — server only); access_token, domain, current_password, new_password (เปลี่ยนรหัส); access_token, domain, type, value, username, message (โอน credit); access_token, domain, limit, time_start, time_end, ไม่บังคับ currency_name, source, language (ledger); access_token, domain, action, ไม่บังคับ current_device_id, device_id, device_name, device_info, language (อุปกรณ์เซสชัน); หรือ access_token, domain (me). Header: Authorization: Bearer <token> เมื่อใช้ Bearer style
→ Gommo public API · สมัครสมาชิก · เปลี่ยนรหัสผ่าน · โอน credit · ประวัติธุรกรรม · อุปกรณ์เซสชัน · ตั๋วซัพพอร์ต · โปรแกรมพาร์ทเนอร์ · Creator Rewards · เริ่มต้นใช้งาน
Playground — auth API test vs Connection
Playground — System → Login API (ทดสอบ) และ Register API (ทดสอบ) เรียก POST /gateway/auth/login และ /gateway/auth/register แสดง JSON เหมือน worker อื่น ไม่ บันทึก token ไม่ เปลี่ยน Connection (ใช้ Connection → Sign in หรือ /th/signup/ เพื่อเก็บ session) domain มาจาก tenant dealer บนเซิร์ฟเวอร์ — ไม่มี field บนฟอร์ม Register ต้องมี env merchant บน gateway Mode A ยังต้องส่ง domain ใน form เมื่อเรียก Gommo โดยตรง
Home feed → แพลตฟอร์ม — เปลี่ยนรหัสผ่าน, โอน credit, ประวัติธุรกรรม, อุปกรณ์เซสชัน, ตั๋วซัพพอร์ต, โปรแกรมพาร์ทเนอร์ และ Creator Rewards ใช้ Bearer ที่เชื่อมต่อ (ดู เปลี่ยนรหัสผ่าน, โอน credit, ประวัติธุรกรรม, อุปกรณ์เซสชัน, ตั๋วซัพพอร์ต, โปรแกรมพาร์ทเนอร์, Creator Rewards)
โดเมนผิด
Field domain ใน form คือ โดเมนลงทะเบียน user บน Gommo (dealer tenant) — ไม่ใช่ api.gommo.net หรือ v2.api.gommo.net ต้องตรงตอน signup อย่าคัดลอกโดเมนจาก docs โดเมนผิด → auth ล้มเหลว credit/billing ผิด dealer
โดเมนลงทะเบียน
| แหล่ง | ใช้เมื่อ |
|---|---|
| Signup user / docs dealer | Production — แต่ละ user มีโดเมนลงทะเบียนคงที่ |
$env:GOMMO_API_DOMAIN (PowerShell) | สคริปต์ — ตั้งก่อนรันตัวอย่าง |
%REGISTRATION_DOMAIN% (curl.exe) | curl Windows — ตั้งใน shell |
Hostname docs + GET /gateway/site | Portal self-host — site-config → registration domain; local ใช้ GOMMO_API_DOMAIN |
Integrator เก็บโดเมนลงทะเบียน ต่อ user (จาก flow signup) อย่า hardcode โดเมน dealer ในแอป
ลงชื่อเข้าใช้บน site docs
site เอกสาร (dev :5173) มี flow บัญชีในตัว:
| หน้า | URL |
|---|---|
| ลงชื่อเข้าใช้ | /th/login/ |
| สมัคร | /th/signup/ |
| Dashboard (หลัง login) | /th/app/ |
หลัง login/สมัครสำเร็จ เบราว์เซอร์ไป /th/app/ (ภาพรวม) token เก็บใน localStorage key gw_access_token profile และ credits จาก POST /ai/me
วาง token dev
บน /th/login/ แท็บ Bearer token สำหรับวาง access_token Gommo (ทดสอบไม่ต้อง email/password)
Cursor MCP (Gommo)
หลัง login คัดลอก token จาก /th/app/token/ ไป Gommo MCP — ดู 10 tools และ prompt ตัวอย่าง
User token
ใช้ access_token สำหรับทุก Gommo API call
Domain: ส่ง domain ใน form body — โดเมนลงทะเบียนบัญชี (โดเมนลงทะเบียน — อย่าคัดลอกจาก docs)
Login โดยตรง
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%"$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 $bodyresponse มี access_token — เก็บเป็น $TOKEN
V2 media jobs
- Header:
Authorization: Bearer {access_token} - Form body:
domain,project_id,prompt, …
Platform / chat / audio (form)
- Form field:
access_token={token}หรือ Bearer header - Form field:
domain— โดเมนลงทะเบียนบัญชี
Admin / merchant (เซิร์ฟเวอร์เท่านั้น)
/th/admin/* ไม่ ใช้ Bearer user
| Header | Env เซิร์ฟเวอร์ |
|---|---|
x-admin-key: {ADMIN_API_KEY} | ADMIN_API_KEY |
ตรวจสอบ session
โหลดผู้ใช้และยอดเครดิต dashboard docs (/th/app/) และเติมเงินใช้ endpoint นี้
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%"$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ส่ง device_id, device_name, และ device_info ใน form (เหมือนแอป Gommo platform) เพื่อให้ balancesInfo.credits_ai มีค่า
ทางเลือก: self-host (operator)
Deploy repo (npm run dev, Docker) เพิ่ม mount JSON/proxy สำหรับ portal, billing, BYOK preview — ไม่ใช่สัญญาการเชื่อมต่อ Gommo public
