TUNGKAO Dokumentasi API
Tekan tombol lalu pilih “Simpan sebagai PDF”

TUNGKAO API

Masuk dengan TikTok

API v1 · Terakhir diperbarui: Waktu Thailand (UTC+07:00)

https://tungkao.com · https://api.tungkao.com/docs

Sesuai ketentuan, halaman yang memakai layanan wajib menampilkan “Powered by TUNGKAO” (atau “Secured by TUNGKAO” untuk login/pembayaran) yang tertaut ke https://tungkao.com

API · tiktok_login

Masuk dengan TikTok

Tambahkan tombol 'Masuk dengan TikTok' ke situs tanpa mendaftar ke TikTok sendiri. Anda mendapat: nama tampilan, avatar (TikTok tidak memberi email)

🕒 Terakhir diperbarui: Waktu Thailand (UTC+07:00) · ✅ Kode lama tetap berjalan

🤖 Minta AI menulis integrasinya

Salin tautan ini untuk dibaca AI (seluruh API dalam Markdown) atau tekan tombol: prompt disalin dan AI dibuka

https://api.tungkao.com/docs/api/tiktok_login.md?lang=id
https://api.tungkao.com/changelog/tiktok_login.json

Tautan ini mengembalikan pembaruan API ini sebagai JSON (tanpa key, dari asal mana pun). Tampilkan di halaman admin sebagai kotak “Pengumuman pembaruan” dan tandai “Baru” saat last_updated berubah

Salin + buka di: Menekan tombol AI otomatis menyalin prompt — jika kotak chat kosong, tinggal tempel

🔑 Key yang dipakai

Buat key tiktok_login di portal merchant (API key) dan kirim header ini di setiap request — key layanan lain tidak berfungsi di sini

Authorization: Bearer $TUNGKAO_KEY

🔗 Tautan tombol login Anda

https://api.tungkao.com/oauth/authorize?client_id=<CLIENT_ID>&redirect_uri=https%3A%2F%2Fyourshop.com%2Fauth%2Fcallback&state=<RANDOM>

🛡️ Semua berakhir di tungkao: pengguna login dengan TikTok dan selalu kembali ke tungkao dulu. Kami meneruskan ke tautan Anda hanya setelah login benar-benar berhasil (atau dibatalkan saat login) — yang membuka tautan langsung hanya melihat halaman tungkao. Atur 🌐 domain (verifikasi) dan ↩️ tautan kembali di 'Member'.

Yang Anda dapat: nama tampilan, avatar (TikTok tidak memberi email)

📋 Langkah

  1. Buat key untuk penyedia, lalu di 'Member login' atur nama situs dan redirect URI (https, sama persis).
  2. Tombol login mengarahkan pengguna ke /oauth/authorize dengan client_id (ID key), redirect_uri, dan state (acak baru, disimpan di session).
  3. Pengguna kembali ke redirect_uri?code=…&state=… → cek state → server memanggil POST /v1/login/token dalam 2 menit.
  4. Gunakan data.user (mis. 7F3K9QX2-yourshopcom) sebagai ID member — orang yang sama selalu mendapat ID yang sama.

📡 Panggilan API + contoh kode

POST/v1/login/token
curl -X POST https://api.tungkao.com/v1/login/token \
  -H "Authorization: Bearer $TUNGKAO_KEY" \
  -H "Content-Type: application/json" \
  -d '{"code":"from the redirect","redirect_uri":"https://yourshop.com/auth/callback"}'
GET/v1/login/users?limit=50
curl -X GET https://api.tungkao.com/v1/login/users?limit=50 \
  -H "Authorization: Bearer $TUNGKAO_KEY"

📖 Summary: using sign-in keys on several sites

KasusPengaturan key (halaman API Keys)Hasil
One site, 2 keys of the same provider (e.g. website + app, both Google)Both keys: Combined (default)The same person gets the same user ID in both ✅
One site, 2 keys of the same provider, counted as separate accountsBoth keys: SeparateThe same person gets a different user ID on each key
2 sister sites sharing membersBoth keys: Group AA member has the same user ID on both sites ✅
2 unrelated sites that must not link membersBoth keys: SeparateDifferent user IDs, so the sites can't link their members ✅
A Google key and a LINE key (different providers)Any settingAlways different user IDs — they are different provider accounts
A key that already has sign-ins needs a different groupNot allowed (locked 🔒)Create a new key in the wanted group, so member IDs on your site never change

Set it on the “Sign-in user IDs between keys” card on the API Keys page before go-live (new keys default: Combined). Several keys may use the same domain.

Contoh lengkap (tombol + callback + tukar code)

// npm i express express-session
import express from "express";
import session from "express-session";
import crypto from "node:crypto";

const KEY = process.env.TUNGKAO_KEY;            // API key (tk_live_…) server-side only
const CLIENT_ID = process.env.TUNGKAO_CLIENT_ID; // the key id (shown in the portal), not a secret
const REDIRECT = "https://yourshop.com/auth/callback"; // must match the registered URL exactly

const app = express();
app.use(session({ secret: process.env.SESSION_SECRET, resave: false, saveUninitialized: false, cookie: { secure: true, sameSite: "lax" } }));

// 1) your "Sign in" button links here
app.get("/auth/login", (req, res) => {
  req.session.state = crypto.randomBytes(24).toString("base64url");
  const u = new URL("https://api.tungkao.com/oauth/authorize");
  u.search = new URLSearchParams({ client_id: CLIENT_ID, redirect_uri: REDIRECT, state: req.session.state });
  res.redirect(u);
});

// 2) the user comes back with a code
app.get("/auth/callback", async (req, res) => {
  if (!req.query.state || req.query.state !== req.session.state) return res.status(400).send("state mismatch");
  delete req.session.state;
  if (req.query.error) return res.redirect("/login?cancelled=1");
  // 3) exchange the code for the user (within 2 minutes)
  const r = await fetch("https://api.tungkao.com/v1/login/token", {
    method: "POST",
    headers: { Authorization: `Bearer ${KEY}`, "Content-Type": "application/json" },
    body: JSON.stringify({ code: req.query.code, redirect_uri: REDIRECT }),
  });
  const j = await r.json();
  if (!j.success) return res.status(400).send(j.error.message);
  req.session.user = j.data; // j.data.user = permanent member id, e.g. 7F3K9QX2-yourshopcom
  res.redirect("/");
});
app.listen(3000);
PenyediaLayananYang Anda dapat
Googlegoogle_loginnama, email terverifikasi, foto
LINEline_loginnama, foto, email jika pengguna setuju
Facebookfacebook_loginnama, foto, email
TikToktiktok_loginnama tampilan, avatar (tanpa email)
Discorddiscord_loginnama, avatar, email
Telegramtelegram_loginname, username, photo
X (Twitter)x_loginname, username, photo
Microsoftmicrosoft_loginname, email (Hotmail/Outlook)
GitHubgithub_loginname, email, avatar
Appleapple_loginpermanent member ID (no name or email in this mode)
Steamsteam_loginname, avatar and SteamID (no email)
Twitchtwitch_loginname, email, avatar
LinkedInlinkedin_loginname, email, photo
Kakaokakao_loginname, photo (email once Kakao approves it)
NAVERnaver_loginname, email, photo
Zalozalo_loginname, photo (no email)
Spotifyspotify_loginname, email, photo
Redditreddit_loginusername, avatar (no email)
GitLabgitlab_loginname, email, avatar
Robloxroblox_loginname, avatar (no email)
Epic Gamesepicgames_logindisplay name (no email)
Yahooyahoo_loginname, email, photo
Slackslack_loginname, email, photo
Amazonamazon_loginname, email

📚 Contoh penggunaan

Contoh 1

A “Sign in with TikTok” button on your site

Situasi: A visitor taps Sign in with TikTok on your site

Permintaan
GET /oauth/authorize?client_id=<CLIENT_ID>&redirect_uri=https://yourshop.com/auth/callback&state=xyz

➡️ The user signs in with TikTok and returns to redirect_uri with a code and the same state

Contoh 2

Exchange the code for the user (server side)

Situasi: Your server receives the code on the callback page (exchange within 2 minutes)

Permintaan
POST /v1/login/token
{
  "code": "<code from the callback>",
  "redirect_uri": "https://yourshop.com/auth/callback"
}
Contoh respons
{
  "success": true,
  "data": {
    "user": "7F3K9QX2-yourshopcom",
    "provider": "tiktok",
    "name": "Somchai",
    "is_new_user": true
  }
}

➡️ Use user as the member id in your database (stable per person)

Contoh 3

A returning user signs in

Situasi: The same person signs in with TikTok again

Contoh respons
{
  "success": true,
  "data": {
    "user": "7F3K9QX2-yourshopcom",
    "is_new_user": false,
    "login_count": 5
  }
}

➡️ Same user every time → look up the member and sign them in

Contoh 4

One site, two TikTok keys (website + app)

Situasi: Separate keys for website and app, same members

➡️ Keep both keys “Combined” (default) before go-live → same user for the same person. Choose “Separate” to keep them apart

Contoh 5

List members who signed in

Situasi: You want to browse or search members of this key

Permintaan
GET /v1/login/users?q=somchai&limit=50

➡️ Returns members with last sign-in time and count

Contoh 6

The user cancels during sign-in

Situasi: The user cancels on the TikTok screen

➡️ Returns to redirect_uri with error instead of code; show a retry button

💡 Lainnya

📜 Riwayat pembaruan API ini

  1. Ditambah Waktu Thailand (UTC+07:00)
    🖼️ Show your own logo on the sign-in page, per key (50×50, auto-cropped and resized). Billed monthly: buy 1–11 months or 1 / 2 / 3 years. Hiding the credit now offers the same periods.
  2. Ditingkatkan Waktu Thailand (UTC+07:00)
    🌐 The sign-in page and the phone-model sign-in help now support all 10 API languages (th, en, lo, my, zh-CN, ko, ja, vi, km, id), picked from the device language or &lang= on the sign-in link, with a language switcher at the bottom
  3. Ditingkatkan Waktu Thailand (UTC+07:00)
    📱 The sign-in help page now names the visitor's exact phone model (e.g. Galaxy S24 Ultra), adds model search, and refreshes the Android model list daily from Google Play — new models get a “New” badge
  4. Ditambah Waktu Thailand (UTC+07:00)
    📱 Step-by-step “sign-in doesn't continue” help by phone brand and model (iPhone, iPad, Samsung, Huawei, HONOR, Xiaomi, OPPO, vivo, realme, OnePlus, Pixel, other Android), with the brand guessed from the device and a link from the sign-in page
  5. Ditambah Waktu Thailand (UTC+07:00)
    Sign-in: choose whether user IDs are combined or separate between keys (whole account / group A–E / separate). New keys default to combined; keys that already have sign-ins stay in their group
  6. Ditambah Waktu Thailand (UTC+07:00)
    API update announcements by webhook: new api.update event (opt in per key on the key card; off by default)
  7. Ditingkatkan Waktu Thailand (UTC+07:00)
    📣 Notice: phones with two copies of a provider's app (app clone / Dual Messenger / dual apps) cannot sign in through the clone — confirmed for LINE (unknown-error dialog). The sign-in page now warns users for every app-based provider, and the sign-in link accepts &app=browser / &app=native
  8. Ditambah Waktu Thailand (UTC+07:00)
    Mobile sign-in that jumps to the provider app (X, Discord, LINE…): two per-key options — A stay in the same browser (Android, recommended), B the original tab signs in on return (tk-login.js). Desktop is unaffected
  9. Ditambah Waktu Thailand (UTC+07:00)
    Ready-made sign-in buttons: /static/tk-login.js restyles your existing buttons with real logos and colours (add data-tk-login)
  10. Ditingkatkan Waktu Thailand (UTC+07:00)
    A bad sign-in link (client_id / redirect_uri / state) now shows a page with the reason and the fix instead of redirecting home
  11. Ditambah Waktu Thailand (UTC+07:00)
    error.user_message: ready-to-show text for end users on outages, no credits or key problems (white-label keys omit tungkao.com)
  12. Ditambah Waktu Thailand (UTC+07:00)
    GET /status: status API per layanan (tanpa key)
  13. Ditambah Waktu Thailand (UTC+07:00)
    Sakelar on/off key dengan waktu perubahan + satu key per layanan per situs
  14. Ditingkatkan Waktu Thailand (UTC+07:00)
    API v1 dibekukan permanen (hanya penambahan) + header X-Tungkao-Api-Version + pemberitahuan penghentian 12 bulan
  15. Dokumen Waktu Thailand (UTC+07:00)
    Halaman dokumen per API dengan tautan AI (10 bahasa)
  16. Keamanan Waktu Thailand (UTC+07:00)
    Verifikasi domain per API key (1 key = 1 situs) — key lama tetap berfungsi
  17. Ditambah Waktu Thailand (UTC+07:00)
    Tanda tangan request HMAC opsional — tidak ada yang berubah jika tidak diaktifkan
  18. Baru Waktu Thailand (UTC+07:00)
    Meluncurkan login LINE, Facebook, TikTok, dan Discord
  19. Ditambah Waktu Thailand (UTC+07:00)
    Masa berlaku API key, pengingat, dan perpanjangan — string key tidak berubah
  20. Ditambah Waktu Thailand (UTC+07:00)
    Key mode test (simulasi, gratis) untuk semua layanan

✅ Kode lama tetap berjalan

🛡️ Janji stabilitas: integrasi sekali, terus berjalan

🚦 Status sistem (GET /status)

Cek kapan saja apakah API normal — tanpa key

GET https://api.tungkao.com/status

curl https://api.tungkao.com/status
{
  "success": true,
  "data": {
    "status": "ok",
    "services": [
      { "id": "slip_verify", "status": "ok", "routes": ["ok", "ok", "busy"] },
      { "id": "slip_deposit", "status": "ok", "routes": ["ok", "ok", "busy"] },
      { "id": "login", "status": "ok" },
      { "id": "telegram", "status": "ok" },
      { "id": "discord", "status": "ok" },
      { "id": "email", "status": "busy" },
      { "id": "crypto", "status": "ok" },
      { "id": "core", "status": "ok" }
    ],
    "paused": [],
    "updated_at": "2026-11-14T12:00:00.000Z"
  }
}

🏷️ Ketentuan mencantumkan kredit TUNGKAO

Powered by TUNGKAO