TikTok api

This commit is contained in:
2026-07-08 19:03:40 +02:00
parent 01284f5283
commit a7d6d3bce9
5 changed files with 1302 additions and 0 deletions

View File

@@ -24,3 +24,13 @@ SMTP_PASS=
# Cron job protection — generate with: openssl rand -base64 32
CRON_SECRET=
# TikTok OAuth / posting (server-side only)
# Source of truth for cron posting: QRMaster server .env
# Production example: https://qrmaster.net/api/tiktok/callback
# Local dev example: http://localhost:3000/api/tiktok/callback
# Tokens are saved in the DB after the OAuth callback; do not store access tokens here.
TIKTOK_CLIENT_KEY=aw2l7czcin3uk426
TIKTOK_CLIENT_SECRET=LapujWkqpZfj1jgWBeCzFhw2nuhMPMBA
TIKTOK_REDIRECT_URI=https://qrmaster.net/api/tiktok/callback
TIKTOK_ADMIN_KEY=yV0CzlXyw00kFc7hnnJZv_eoH5WaqGsD5l8_GH7Aj2s

17
Userstimo.hermes.env Normal file
View File

@@ -0,0 +1,17 @@
Greenlens TikTOk
TIKTOK_CLIENT_KEY=awoihp5i4k4rraen
TIKTOK_CLIENT_SECRET=TdnxlcQLNRXAy2PW0GsSlQTEqGeHgU7x
TIKTOK_REDIRECT_URI=https://greenlenspro.com/api/tiktok/callback
PLANT_IMPORT_ADMIN_KEY=greenlens-admin-2024
Qrmaster
TIKTOK_CLIENT_KEY=aw2l7czcin3uk426
TIKTOK_CLIENT_SECRET=LapujWkqpZfj1jgWBeCzFhw2nuhMPMBA
TIKTOK_REDIRECT_URI=https://qrmaster.net/api/tiktok/callback
TIKTOK_ADMIN_KEY=yV0CzlXyw00kFc7hnnJZv_eoH5WaqGsD5l8_GH7Aj2s

View File

@@ -54,6 +54,10 @@ services:
NEXTAUTH_SECRET: ${NEXTAUTH_SECRET}
NEXT_PUBLIC_APP_URL: ${NEXT_PUBLIC_APP_URL:-http://localhost:3050}
INTERNAL_API_SECRET: ${INTERNAL_API_SECRET}
TIKTOK_CLIENT_KEY: ${TIKTOK_CLIENT_KEY:-}
TIKTOK_CLIENT_SECRET: ${TIKTOK_CLIENT_SECRET:-}
TIKTOK_REDIRECT_URI: ${TIKTOK_REDIRECT_URI:-https://qrmaster.net/api/tiktok/callback}
TIKTOK_ADMIN_KEY: ${TIKTOK_ADMIN_KEY:-}
IP_SALT: ${IP_SALT:-your-salt-change-in-production}
ENABLE_DEMO: ${ENABLE_DEMO:-false}
NEXT_PUBLIC_INDEXABLE: ${NEXT_PUBLIC_INDEXABLE:-true}

View File

@@ -0,0 +1,64 @@
# Social Accounts
## Account Mapping
| Brand | Facebook Page | Facebook Page ID | Instagram Business Account | Instagram User ID | X/Twitter Account | Target Username |
| --- | --- | --- | --- | --- | --- | --- |
| QRMaster.net | QRMaster.net | 884792004727212 | QRMaster.net | 17841480094799114 | TIMO_QRMASTER | qrmaster |
| GreenLens Pro | GreenLens Pro | 1150261294842586 | GreenLens Pro | 17841422012320229 | greenlensproai | greenlens.pro |
## Brand Rules
- QRMaster-Posts dürfen **nur** auf `QRMaster.net`-Accounts posten.
- GreenLens-Posts dürfen **nur** auf `GreenLens Pro`-Accounts posten.
- Kein Crossposting zwischen Brands.
- Token niemals öffentlich teilen; nur Referenz in dieser Datei.
## Scripts
| Path | Purpose |
| --- | --- |
| `C:\Users\timo\Documents\meta_token_refresh.py` | Meta Long-Lived + Page Token Refresh |
| `C:\Users\timo\Documents\instagram_r2_carousel_post.py` | Instagram single-image/carousel über R2 |
| `C:\Users\timo\x-api-autopost\x_media_post.py` | X/Twitter for QRMaster |
| `C:\Users\timo\greenlens-x-autopost\` | X/Twitter for GreenLens |
## Token Files / Paths
| Path | Contains |
| --- | --- |
| `C:\Users\timo\Documents\meta_instagram_tokens.env` | Meta Facebook + Instagram long-lived/page tokens |
| `C:\Users\timo\Documents\r2_social_media.env` | R2 upload credentials for IG assets |
| `C:\Users\timo\Documents\instagram_r2_carousel_post.py` | uses both env files above |
| `C:\Users\timo\Documents\XApiAutopost\.env` | X/Twitter QRMaster creds |
| `C:\Users\timo\Documents\greenlens-x-autopost\.env` | X/Twitter GreenLens creds |
| `C:\Users\timo\Documents\greenlens\Greenlens\.env` | GreenLens TikTok + plant import admin creds |
## QRMaster TikTok Cron Credentials
- Source of truth: the server-side `.env` for the QRMaster app.
- Required variables: `TIKTOK_CLIENT_KEY`, `TIKTOK_CLIENT_SECRET`, `TIKTOK_REDIRECT_URI`.
- Optional helper: `TIKTOK_ADMIN_KEY` for guarding the `/api/tiktok/connect` start route.
- OAuth result: access/refresh tokens are stored in the database after `/api/tiktok/connect` and `/api/tiktok/callback`.
- Do not put TikTok access tokens in `.env`; the cron job reads them from the DB through the app flow.
- For cron posting, use the same QRMaster server environment that already contains `CRON_SECRET` / `INTERNAL_API_SECRET` for internal APIs.
## Refresh Behavior
- Meta user/page tokens werden automatisch refreshed durch `python C:\Users\timo\Documents\meta_token_refresh.py`.
- QRMaster Page-Auswahl erzwingt Page-ID `884792004727212`.
- GreenLens Page-Auswahl erzwingt Page-ID `1150261294842586`.
## Cron Jobs
| Job Name | Schedule | Deliver | Notes |
| --- | --- | --- | --- |
| `Weekly Meta Token Refresh` | Montag 09:00 | Telegram + Email | Refreshes Meta tokens |
> Social-package deliverables only after explicit `Go`.
## Publish Checklist
1) Brand wählen → nur passende Accounts zulassen.
2) Media vorbereiten: QRMaster → R2-Prefix `qrmaster/`, GreenLens → `greenlens/`.
3) Facebook: Page-ID + Page-Token verwenden.
4) Instagram: IG User ID + Page-Token über Container + `media_publish`.
5) X: zugehöriges Brand-Skript + zugehöriges `.env` verwenden.
6) Keine Token/Secrets loggen.

1207
landing-preview.html Normal file

File diff suppressed because it is too large Load Diff