Test your server
Before you open the page in a browser, run these four commands
(replace shop.example.com with your app host). They exercise the same
routes your page calls in step 3 and
step 5 — if any command fails here, fix the server
first; the iframe will not work until these endpoints respond correctly.
What each line should return
-
curl -s https://shop.example.com/api/configHTTP 200 and JSON on stdout, for example
{ "authOrigin": "https://auth.kie.la", "profileFields": […], … }. Confirms your server is up and exposes public embed settings. No cookie required. If you get connection refused or 502, the app is not listening or crashed at startup. -
curl -s "https://shop.example.com/api/auth/embed?authUi=header&parentOrigin=https://shop.example.com"HTTP 200 and
{ "url": "https://auth.kie.la/login-header?embed=1&…" }(exact path depends onauthUi). Your server builds the iframe URL server-side with your app name and uuid — the browser never sees the uuid in JavaScript. 400 withparentOrigin requiredmeans the query string is missing or wrong; copy the full URL from the command above. -
curl -s -o /dev/null -w '%{http_code}' https://shop.example.com/api/mePrints 401 on stdout before anyone has signed in — that is the expected result. It means “no session cookie yet”, not a misconfiguration. After a successful sign-in in the browser, the same command with the session cookie should print 200 and JSON
{ "profile": { … } }(usecurl -s -b cookies.txt …if you saved cookies from the browser). -
curl -s -X POST https://shop.example.com/api/session \ -H 'Content-Type: application/json' \ -d '{"exchange":"…","parentOrigin":"https://shop.example.com"}'With the placeholder
exchangein the command above, the expected output is{"error":"Exchange invalide ou expiré"}(401) — you cannot forge this token. After a real sign-in in the iframe,kie-la-auth.jsPOSTs the one-time exchange your server receives frompostMessage; then expect 200,{ "ok": true, "profile": { … } }, and aSet-Cookieheader for your session. Use this line only to debug session exchange once the iframe flow works.
In DevTools → Network, filter by your domain to see
/api/me, /api/config, /api/auth/embed, and
/api/session. The verify call appears under the auth server host
(iframe). postMessage does not appear there — that is normal.