The Android key (6LdrqmAp...) only works with the Android SDK — it rejects all web-based token generation with "Invalid domain." Discovered that perfectdraft.com's web login uses a separate Enterprise web key (6LcZQiUo...) with action "Magento/login". Testing confirmed the API at api.perfectdraft.com accepts tokens from this web key. The only remaining requirement is a high reCAPTCHA score, which a real user's browser will provide. The external step flow now uses: - Enterprise JS (recaptcha/enterprise.js) - Web site key: 6LcZQiUoAAAAAAO3JUjLiT470c-pNXbWyepuvMtV - Action: Magento/login Removed server-side token generation attempt from config flow since it cannot produce high-score tokens. Made-with: Cursor
86 lines
3.1 KiB
HTML
86 lines
3.1 KiB
HTML
<!DOCTYPE html>
|
||
<html lang="en">
|
||
<head>
|
||
<meta charset="utf-8">
|
||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||
<title>PerfectDraft – Verification</title>
|
||
<style>
|
||
* { box-sizing: border-box; margin: 0; padding: 0; }
|
||
body {
|
||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
|
||
display: flex; align-items: center; justify-content: center;
|
||
min-height: 100vh; background: #f5f5f5; color: #333;
|
||
}
|
||
.card {
|
||
background: #fff; border-radius: 12px; padding: 2.5rem;
|
||
box-shadow: 0 2px 12px rgba(0,0,0,.08); max-width: 420px;
|
||
width: 100%; text-align: center;
|
||
}
|
||
h1 { font-size: 1.25rem; margin-bottom: .75rem; }
|
||
.spinner {
|
||
width: 40px; height: 40px; margin: 1.5rem auto;
|
||
border: 4px solid #e0e0e0; border-top-color: #1976d2;
|
||
border-radius: 50%; animation: spin .8s linear infinite;
|
||
}
|
||
@keyframes spin { to { transform: rotate(360deg); } }
|
||
.status { font-size: .95rem; color: #666; }
|
||
.error { color: #c62828; display: none; }
|
||
.success { color: #2e7d32; }
|
||
</style>
|
||
</head>
|
||
<body>
|
||
<div class="card">
|
||
<h1>PerfectDraft Verification</h1>
|
||
<div id="loading">
|
||
<div class="spinner"></div>
|
||
<p class="status">Completing verification…</p>
|
||
</div>
|
||
<p id="success" class="status success" style="display:none">
|
||
Verification complete! You can close this window.
|
||
</p>
|
||
<p id="error" class="status error">
|
||
Verification failed. Please check your network connection and try again.
|
||
</p>
|
||
</div>
|
||
|
||
<script src="https://www.google.com/recaptcha/enterprise.js?render=RECAPTCHA_SITE_KEY"></script>
|
||
<script>
|
||
(function () {
|
||
var params = new URLSearchParams(window.location.search);
|
||
var callbackUrl = params.get("callback");
|
||
var flowId = params.get("flow_id");
|
||
|
||
if (!callbackUrl || !flowId) {
|
||
document.getElementById("loading").style.display = "none";
|
||
document.getElementById("error").style.display = "block";
|
||
document.getElementById("error").textContent =
|
||
"Missing callback parameters. Please restart the setup flow.";
|
||
return;
|
||
}
|
||
|
||
grecaptcha.enterprise.ready(function () {
|
||
grecaptcha.enterprise
|
||
.execute("RECAPTCHA_SITE_KEY", { action: "RECAPTCHA_ACTION" })
|
||
.then(function (token) {
|
||
return fetch(callbackUrl, {
|
||
method: "POST",
|
||
headers: { "Content-Type": "application/json" },
|
||
body: JSON.stringify({ flow_id: flowId, token: token }),
|
||
});
|
||
})
|
||
.then(function (resp) {
|
||
if (!resp.ok) throw new Error("Callback failed: " + resp.status);
|
||
document.getElementById("loading").style.display = "none";
|
||
document.getElementById("success").style.display = "block";
|
||
})
|
||
.catch(function (err) {
|
||
console.error(err);
|
||
document.getElementById("loading").style.display = "none";
|
||
document.getElementById("error").style.display = "block";
|
||
});
|
||
});
|
||
})();
|
||
</script>
|
||
</body>
|
||
</html>
|