What happens
Connecting TikTok on a production install fails on TikTok's side with:
We couldn't log in with TikTok. This may be due to specific app settings.
If you're a developer, correct the following and try again:
* redirect_uri
The redirect URI was registered correctly in the TikTok developer portal. The problem is that TryPost sent an empty one: inside the running container, config('services.tiktok.redirect') is null.
Why
config/services.php reads each platform's callback URL only from its env var, with no fallback:
'tiktok' => [
'client_id' => env('TIKTOK_CLIENT_ID'),
'client_secret' => env('TIKTOK_CLIENT_SECRET'),
'redirect' => env('TIKTOK_CLIENT_REDIRECT'),
],
The *_CLIENT_REDIRECT variables are defined in docker/.env.docker.example (the development template), but compose.prod.yaml only has placeholders for *_CLIENT_ID and *_CLIENT_SECRET. Anyone following the production compose file gets a null redirect for every OAuth platform that uses one, not only TikTok.
Adding TIKTOK_CLIENT_REDIRECT: https://<domain>/accounts/tiktok/callback fixed it immediately.
Suggested fix
Either of these would work. The first removes the problem entirely:
-
Derive a default from APP_URL in config/services.php, so the env var becomes an override rather than a requirement:
'redirect' => env('TIKTOK_CLIENT_REDIRECT', rtrim((string) env('APP_URL'), '/').'/accounts/tiktok/callback'),
-
Add the redirect lines to compose.prod.yaml alongside each commented-out *_CLIENT_ID / *_CLIENT_SECRET pair. Note that ${APP_URL} can't be used inside the environment: map there, because Compose interpolates from the host shell or .env, not from the service's own environment. So these would need to be full URLs, or APP_URL would need moving into .env.
Environment
- Image:
ghcr.io/trypostit/trypost:latest (v1.0.9)
compose.prod.yaml from main
What happens
Connecting TikTok on a production install fails on TikTok's side with:
The redirect URI was registered correctly in the TikTok developer portal. The problem is that TryPost sent an empty one: inside the running container,
config('services.tiktok.redirect')isnull.Why
config/services.phpreads each platform's callback URL only from its env var, with no fallback:The
*_CLIENT_REDIRECTvariables are defined indocker/.env.docker.example(the development template), butcompose.prod.yamlonly has placeholders for*_CLIENT_IDand*_CLIENT_SECRET. Anyone following the production compose file gets anullredirect for every OAuth platform that uses one, not only TikTok.Adding
TIKTOK_CLIENT_REDIRECT: https://<domain>/accounts/tiktok/callbackfixed it immediately.Suggested fix
Either of these would work. The first removes the problem entirely:
Derive a default from
APP_URLinconfig/services.php, so the env var becomes an override rather than a requirement:Add the redirect lines to
compose.prod.yamlalongside each commented-out*_CLIENT_ID/*_CLIENT_SECRETpair. Note that${APP_URL}can't be used inside theenvironment:map there, because Compose interpolates from the host shell or.env, not from the service's own environment. So these would need to be full URLs, orAPP_URLwould need moving into.env.Environment
ghcr.io/trypostit/trypost:latest(v1.0.9)compose.prod.yamlfrommain