On this page
Operator steps to turn on the idp sidecar on the production host and hand ContentHeat its client key. Secrets never appear in chat, logs or the repo.
1. Init the environment (once)#
bash scripts/idp/init-env.sh --dry-run # lists the key names it would add
bash scripts/idp/init-env.sh # appends only missing keys to .env.prod
- Derives
IDP_ISSUER,PLATFORM_ISSUER,PLATFORM_JWKS_URLfromDOMAIN; generatesIDP_INTERNAL_TOKEN,IDP_COOKIE_KEYS,YNG_IDP_DB_PASSWORDwithopenssl rand -hex 32. - Builds
IDP_CLIENTS_JSONwith thecontentheatclient (private_key_jwt, ES256, public JWK only) and writes the private key toprivate/contentheat-oidc-client.secret(chmod 600, gitignored). - Never edits an existing line. An existing key with an empty or placeholder value stops the run (exit 2): delete that line and rerun. A second run adds nothing.
- Redirect URIs cover
/api/auth/callback/mso(what better-auth genericOAuth sends) and the older/api/auth/oauth2/callback/mso, each with and without the/appbase path. Another origin:--ce-origin https://heat.msocloud.net --ce-base-path ''on a fresh run, or edit the JSON by hand (exact https literals only).
2. Deploy#
Run through the Monitor tool with a log file and an EXIT_DEPLOY=$? line (CLAUDE.local.md):
./scripts/start-prod.sh --with-idp
It validates the keys, migrates, enables the yng_idp login, creates the first signing key and starts idp after web. Then read the warm-asset-cache: and verify-cdn-cache: lines (§176).
3. Verify#
curl -fsS https://$DOMAIN/.well-known/openid-configuration | node -e 'const d=JSON.parse(require("fs").readFileSync(0));console.log(d.issuer, d.jwks_uri)'
curl -fsS https://$DOMAIN/.well-known/jwks.json | node -e 'const k=JSON.parse(require("fs").readFileSync(0)).keys;console.log(k.length, k.map(x=>x.alg+" "+x.kid))'
Expect issuer equal to https://$DOMAIN, at least one ES256 key, no d member, and the idp container healthy.
4. Hand the client key to ContentHeat#
Give the CE session the path private/contentheat-oidc-client.secret (env fragment: MSO_ISSUER_URL, MSO_CLIENT_ID, MSO_CLIENT_KEY_ID, MSO_CLIENT_KEY_ALG, MSO_CLIENT_PRIVATE_KEY). CE copies it into its own deploy env by file, not through chat. After CE confirms a login, delete the local copy; MSO keeps only the public JWK.
5. Rotation#
- Issuer signing keys:
scripts/idp/keys.ts stage, wait one RP JWKS cache lifetime (CE caches 10 min), thenrotate --overlap-hours 24, restartidp,prunelater. Needs the migrator DB identity. - Internal token or cookie keys: replace the value in
.env.prodby hand (cookie keys: prepend the new key, comma separated, keep the old one for one session lifetime), then./scripts/start-prod.sh --with-idp. - ContentHeat client key: generate a new pair, add its public JWK next to the old one in
IDP_CLIENTS_JSON(max 4 keys), deploy, switch CE to the new private key andMSO_CLIENT_KEY_ID, then remove the old JWK and deploy again.