# Hồ sơ submit review TikTok

Chuẩn bị sẵn để dán vào form ở developers.tiktok.com. Trước khi dán, thay hết
`thugiancuoituan.com` và `thugiancuoituan.com` bằng giá trị thật.

Reviewer TikTok đọc tiếng Anh, nên phần dán vào form để nguyên tiếng Anh.

---

## 1. Ô "Explain how each product and scope works in your app or website"

> Đây là ô bắt buộc. Viết chung chung kiểu "we use TikTok login" là lý do rớt phổ biến nhất.
> Bản dưới đây bám đúng từng dòng code trong `server.js`, nên demo video sẽ khớp với mô tả.

**Dán từ đây:**

```
PRODUCT: LOGIN KIT (WEB)

thugiancuoituan.com is a website where people create an account and sign in. Login Kit is
the only TikTok product we integrate, and we use it exclusively for authentication:
creating an account on first use, and signing that same person back into the same
account on every later visit.

End-to-end flow:

1. On the homepage the user clicks the "Continue with TikTok" button. No TikTok data
   is requested before that click.
2. Our server generates a random `state` value, stores it in the user's session, and
   redirects the browser to https://www.tiktok.com/v2/auth/authorize/ with our client
   key, response_type=code, our registered redirect URI, and the single scope
   user.info.basic.
3. The user reads the permission on TikTok's own consent screen and chooses to
   authorize or cancel. The user's TikTok password is only ever entered on TikTok's
   domain, never on ours.
4. TikTok redirects back to https://thugiancuoituan.com/auth/tiktok/callback with an
   authorization code. We compare the returned `state` against the value held in the
   session and abort the login if they differ (CSRF protection).
5. We exchange the code for an access token at
   https://open.tiktokapis.com/v2/oauth/token/.
6. We call https://open.tiktokapis.com/v2/user/info/ exactly once, requesting only
   the fields open_id, union_id, avatar_url, display_name.
7. We look up open_id in our database. If it is absent we create a new account
   (registration). If it is present we sign the user into their existing account
   (login). A session cookie is set and the user lands on their profile page.

SCOPE: user.info.basic

This is the only scope we request. We request nothing beyond it.

- open_id — stored as the permanent key linking the TikTok identity to the account
  row in our database. Without it we could not distinguish a returning user from a
  new one, and every sign-in would create a duplicate account.
- union_id — stored next to open_id so a user would keep the same account if we
  later add a second TikTok-integrated app under the same developer account.
- display_name — shown on the user's own profile page, so the account is
  recognisably theirs instead of an anonymous numeric ID.
- avatar_url — shown as the profile picture on that same page.

HOW THIS ENRICHES THE USER EXPERIENCE

Users register in a single tap using an identity they already have. There is no new
password to invent, store or lose, no email verification round-trip, and no signup
form to fill in. Their profile is populated with their name and picture immediately,
so the account feels like theirs from the very first screen. For users who reach us
from TikTok, it is the identity they already expect to use.

WHAT WE DO NOT DO

We do not post, comment, like, follow, or send messages on the user's behalf. We do
not read videos, drafts, direct messages, follower lists, or any analytics data. We
never see the user's TikTok password. We request no scope other than user.info.basic.

DATA HANDLING AND DELETION

Access and refresh tokens are stored solely to authenticate the profile lookup for
that user's own account, and are shared with nobody. Every signed-in user can see all
data we hold about them on their profile page — nothing is hidden. A "Delete account
and all data" button on that page calls TikTok's /v2/oauth/revoke/ endpoint to revoke
our access, then erases every record belonging to that user from our database.

Our Terms of Service and Privacy Policy are linked in the footer of every page,
including the logged-out homepage, and both are reachable without opening any menu.
```

**Dán đến đây.**

---

## 2. Nếu gửi bản sửa đổi (follow-up revision)

TikTok yêu cầu bản sửa đổi phải mô tả lại **cả sản phẩm cũ lẫn phần thay đổi**. Giữ
nguyên toàn bộ phần 1 ở trên, rồi thêm khối này vào cuối:

```
CHANGES IN THIS REVISION

Compared with our previous submission, this version changes the following:

- [Ví dụ] Added a "Delete account and all data" button on the profile page, which
  calls /v2/oauth/revoke/ before erasing the user's records.
- [Ví dụ] Terms of Service and Privacy Policy links moved into the footer of every
  page so they are reachable without opening a menu.
- [Ví dụ] Removed the <scope cũ> scope; we now request only user.info.basic.

No new TikTok products or scopes are requested in this revision. Login Kit with
user.info.basic remains the only integration, used exactly as described above.
```

Sửa 3 gạch đầu dòng đó thành thay đổi thật của bạn. Nếu lần trước rớt vì lý do gì,
nói thẳng đã sửa cái đó ra sao — reviewer đối chiếu với lý do từ chối lần trước.

---

## 3. Checklist trước khi bấm Submit

**URL khai trong app**

- [ ] Website URL, Terms of Service URL, Privacy Policy URL đều dùng **cùng một domain**
- [ ] Cả 3 URL đang online, mở được ở chế độ ẩn danh (không đăng nhập)
- [ ] Đã xác minh quyền sở hữu URL ở mục **URL properties** (bắt buộc với app tạo sau
      09/09/2024). Có 2 cách: xác minh theo domain, hoặc tải file chữ ký TikTok cấp lên
      URL prefix. Với dự án này, bỏ file chữ ký vào thư mục `public/` là nó tự phục vụ.

**Nội dung trang**

- [ ] Đã thay hết `thugiancuoituan.com` và `8048competent@uberip.com` trong `public/index.html`,
      `public/terms.html`, `public/privacy.html` — còn sót dấu ngoặc vuông là rớt
- [ ] Email liên hệ là email thật, có người đọc (reviewer có gửi thử)
- [ ] Trang chủ không phải chỉ có mỗi nút đăng nhập — TikTok yêu cầu website khai báo
      phải có thông tin thật về dịch vụ (phần "Dịch vụ này làm gì" trở xuống lo việc này)

**Demo video** — bắt buộc, tối đa 5 video, mỗi video ≤ 50 MB

- [ ] Quay đủ luồng từ đầu đến cuối: mở trang chủ → bấm "Tiếp tục với TikTok" →
      màn hình ủy quyền của TikTok → quay lại trang hồ sơ có tên + ảnh đại diện
- [ ] Domain hiện trên thanh địa chỉ phải **trùng** Website URL đã khai
- [ ] App mới phải quay trong môi trường **sandbox**
- [ ] Nên quay thêm cảnh bấm "Xoá tài khoản và toàn bộ dữ liệu" — chứng minh có
      đường xoá dữ liệu, cái reviewer hay soi

**Phạm vi quyền**

- [ ] Chỉ tick `user.info.basic`. Xin thừa scope mà không dùng đến là lý do rớt chắc chắn.

---

## 4. Nguồn

- [App Review Guidelines](https://developers.tiktok.com/docs/en/app-review-guidelines)
- [Register Your App — URL properties verification](https://developers.tiktok.com/docs/en/getting-started-create-an-app)
- [Developer Guidelines](https://developers.tiktok.com/docs/en/our-guidelines-developer-guidelines)
- [TikTok Developer Terms of Service](https://www.tiktok.com/legal/page/global/tik-tok-developer-terms-of-service/en)
