Skip to content

[Bug] compose.prod.yaml has no *_CLIENT_REDIRECT variables, so OAuth connects fail with a redirect_uri error #349

Description

@Tophhie

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:

  1. 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'),
    
  2. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions