Summary
packages/cli builds the editor child process environment with a hardcoded
MINT_PASCAL_HOST_ORIGIN, which clobbers any value the operator sets. The Mint
plugin therefore always sends a redirect_uri of
http://pascal.localhost:3000/api/plugins/mint/oauth/callback, which Mint's
authorization server rejects with "Mint requires HTTPS or loopback redirect
URIs" — it is neither HTTPS, nor is pascal.localhost an exact loopback host.
There is no configuration that can work around this.
Where
dist/editor-process.js (from @pascal-app/cli@0.1.5):
const state = {
...
url: `http://pascal.localhost:${port}`,
};
const environment = {
...process.env, // operator value lands here...
NODE_ENV: 'production',
HOSTNAME: state.host,
PORT: String(port),
PASCAL_DATA_DIR: options.paths.data,
PASCAL_INSTANCE_ID: instanceId,
PASCAL_RUNTIME_VERSION: runtime.version,
MINT_PASCAL_HOST_ORIGIN: state.url, // ...and is overwritten here
};
The spread includes the operator's value and the explicit key then discards it.
This matters because apps/editor/app/api/plugins/mint/[...path]/route.ts is
written to be configurable:
handleMintPascalRequest(request, {
origin: process.env.MINT_PASCAL_HOST_ORIGIN ?? BASE_URL,
})
The ?? never sees an operator value, because the CLI has already replaced it.
Reproduce
- Run the CLI behind any reverse proxy on a real hostname.
- Set
MINT_PASCAL_HOST_ORIGIN=https://<your-host> in the container environment.
- Confirm it is present:
printenv | grep MINT shows the correct value.
curl -sSD - -o /dev/null https://<your-host>/api/plugins/mint/oauth/start | grep -i location
Observed redirect_uri:
http%3A%2F%2Fpascal.localhost%3A3000%2Fapi%2Fplugins%2Fmint%2Foauth%2Fcallback
Expected: the configured origin.
Suggested fix
Let the environment win when it is set:
MINT_PASCAL_HOST_ORIGIN: process.env.MINT_PASCAL_HOST_ORIGIN || state.url,
That preserves current behaviour for local use and unblocks proxied deployments.
I am running this as a build-time patch locally and it resolves the redirect.
Environment
@pascal-app/cli 0.1.5, editor runtime 0.1.5, Next.js 16.3.0
- Docker (
node:22-bookworm-slim), reverse proxy terminating TLS
- Browser origin is a normal HTTPS hostname
Summary
packages/clibuilds the editor child process environment with a hardcodedMINT_PASCAL_HOST_ORIGIN, which clobbers any value the operator sets. The Mintplugin therefore always sends a
redirect_uriofhttp://pascal.localhost:3000/api/plugins/mint/oauth/callback, which Mint'sauthorization server rejects with "Mint requires HTTPS or loopback redirect
URIs" — it is neither HTTPS, nor is
pascal.localhostan exact loopback host.There is no configuration that can work around this.
Where
dist/editor-process.js(from@pascal-app/cli@0.1.5):The spread includes the operator's value and the explicit key then discards it.
This matters because
apps/editor/app/api/plugins/mint/[...path]/route.tsiswritten to be configurable:
The
??never sees an operator value, because the CLI has already replaced it.Reproduce
MINT_PASCAL_HOST_ORIGIN=https://<your-host>in the container environment.printenv | grep MINTshows the correct value.curl -sSD - -o /dev/null https://<your-host>/api/plugins/mint/oauth/start | grep -i locationObserved
redirect_uri:Expected: the configured origin.
Suggested fix
Let the environment win when it is set:
That preserves current behaviour for local use and unblocks proxied deployments.
I am running this as a build-time patch locally and it resolves the redirect.
Environment
@pascal-app/cli0.1.5, editor runtime 0.1.5, Next.js 16.3.0node:22-bookworm-slim), reverse proxy terminating TLS