LINGTU AI OpenAPI
Creator authorization flow
Commerce publishing, product queries and showcase management all depend on TikTok Shop creator authorization. This page covers authorization only: generate the URL on the server, let the creator open it or scan the QR code, after confirming it must redirect to the callback page and show “SUCCESS/成功” (authorization successful), then list usable accounts. Both video and photo publishing start here.
Authorization flow
Callback link example: https://app.ailingtu.com/oauth/tiktokshop
What each step does
Step 1 · Get the authorization URL
Generate the authorization link on the server for the market and shop type.
- oauthRegion combines the market and shop type, such as us_local, us_cross, gb_local or id_cross
- Call the authorization endpoint from the server so x-api-key never reaches the browser
- Open the returned url directly, or turn it into a QR code for the creator
Step 2 · QR code or browser
The creator scans the QR code or opens the link in a browser and enters the TikTok authorization page.
- Scan the QR code with a phone, or open the url in a browser
- Both entries lead to the same TikTok authorization page
- One QR code is valid for one account only; do not let several creators scan it
Step 3 · Grant permissions
Select the required permissions on the TikTok authorization page.
- Grant the permissions your publishing scenario needs
- Photo posts also need the photo publishing permission; ask for it during authorization
- Missing permission is not an expired token: ask the creator to grant it first
Step 4 · Confirm authorization
The creator confirms with the TikTok account that will publish content.
- Use the same TikTok account that has commerce permission and will publish content
- The account itself is a TikTok account whose commerce permission allows publishing
- Check the account before confirming so authorization does not land on the wrong creator
Step 5 · Callback redirect (must happen)
After confirming, the page must redirect to the callback URL; staying on the authorization page is a failure.
- Clicking confirm must automatically redirect to the callback URL
- Callback link example: https://app.ailingtu.com/oauth/tiktokshop
- Open the callback link in a browser or inside the TikTok app
- No redirect, or a callback page that fails to load, must be treated as failure
- Do not use an embedded WebView; the redirect may not complete
Step 6 · Authorization successful
After the redirect, the authorization succeeds only when the callback page shows “SUCCESS/成功”.
- A creator-side hint without the success page is not enough
- Continue only after the callback page shows “SUCCESS/成功”
- If no success page appears, treat it as a failure and generate a new link
Step 7 · List authorized creators
Query the account after success and keep account id and creatorId.
- Pass authSource=TIKTOK_SHOP_CREATOR to list commerce publishing accounts
- Add hasPhotoPermission=true when the account is used for commerce photo posts
- Use id for product queries and creatorId for publishing tasks; do not mix them
Step 8 · Manage authorization
Recover expired authorization or missing permissions by cause.
- Expired authorization returns “授权过期,请重新授权” and marks the account invalid
- Ask the creator to authorize again with the same oauthRegion, then query accounts again
- Revoke access when the creator should no longer publish
- Missing scope is not an expired token: guide the creator to grant permissions first
Key branches
Redirect and confirmation
Confirming must redirect to the callback URL, and only then does “SUCCESS/成功” count; no redirect or no success page is a failure.
One QR code, one account
The QR code or authorization URL binds a single account; generate a new one for every creator account.
Expired authorization
The account is marked invalid and the API returns “授权过期,请重新授权”. Authorize again and re-query accounts.
Missing photo permission
Photo posts require PHOTO_SHOPPABLE_PERMISSION_PRODUCT or PHOTO_SHOPPABLE_PERMISSION_SHOP in permissions; without either, the account cannot publish commerce photos.
Permission refresh
Use sync to refresh creator permissions when they change; it does not change the authorization state.
Revoke access
Revoke when the creator should no longer publish; later publishing attempts fail until authorized again.
Integration notes
- Authorization URLs are generated per oauthRegion; pick the market and shop type that match the TikTok account being authorized.
- The authorized entity is a TikTok account; what makes it usable here is its commerce permission.
- Confirming must redirect to the callback URL, and the page must show “SUCCESS/成功” before listing accounts; no redirect or no success page is a failure.
- A QR code or authorization URL binds a single account; never let several creators scan the same code.
- Generate the URL on the server and never expose the API key in browser code, QR codes or logs.
- Photo posts need an extra permission; check it during authorization instead of failing at publish time.
- The authorized account id and creatorId serve different endpoints; store both after listing accounts.