Embedded Signup
Embedded Signup lets players sign up for your game and community from your own website. You build and style the form; FirstLook sends a verification email and adds confirmed signups to your player list. Players can enter a six-digit code on your site or follow the confirmation link in their email.
Use it to collect interest or newsletter signups without sending players through your full signup flow. New players receive a dedicated Embedded Signup role and join its waitlist. You can find them in Players and use their role to target announcements or select a cohort later.
Turn it on
Section titled “Turn it on”Once our team has enabled access:
-
Open Embedded Signup under Player site in your game’s settings.
-
On Settings, turn on Allow signups.
-
Add your Website origins, one per line, and click Save Changes. For example:
https://yourgame.comhttps://www.yourgame.comhttp://localhost:3000An origin is the scheme, hostname, and port, without a path, query string, or trailing slash. HTTPS is required except for local development. Add each origin you use explicitly; wildcards aren’t supported, and
www.yourgame.comandyourgame.comare separate origins. -
Open Role to change the role’s name and description if needed. Saving with Allow signups enabled creates the role if it doesn’t exist yet.
-
Under reCAPTCHA on the Settings page, click the copy button next to Site key. Paste this key into your form’s reCAPTCHA configuration. The field is read-only and shows the key configured for FirstLook’s verification; use it rather than a key from a separate reCAPTCHA project. It’s a public key, so it can be included in your website’s code.
The role uses an email-only flow managed by FirstLook. The embedded form doesn’t collect your normal signup questions, platform connections, or NDA acceptance, and completing it doesn’t grant game access. If you need those steps before accepting a signup, use a standard signup flow.
Turning Allow signups off closes both new attempts and pending verifications. Players already signed up remain in your player list.
Add a form to your website
Section titled “Add a form to your website”This is a custom HTML and JavaScript integration. There is no iframe to configure: your form calls the signup endpoints on your game’s FirstLook player-site domain.
In the example below, replace:
https://yourgame.firstlook.ggwith your game’s player-site URL, including your custom domain if you use one.YOUR_FIRSTLOOK_RECAPTCHA_SITE_KEYwith the site key copied from Embedded Signup → Settings → reCAPTCHA.
Serve the page from one of your allowed origins. Opening an HTML file directly from disk won’t work. These requests run in the player’s browser and don’t need a FirstLook API key or login. Keep credentials: "omit"; the browser supplies the Origin header automatically.
Email and code verification
Section titled “Email and code verification”This example sends the verification email, then lets the player enter its code without leaving your site. It uses invisible reCAPTCHA v2 before sending the email.
<form id="signup-form"> <label for="signup-email">Email address</label> <input id="signup-email" type="email" autocomplete="email" required /> <div id="signup-captcha"></div> <button id="send-code" type="submit" disabled>Send verification email</button></form>
<form id="verify-form" hidden> <label for="signup-code">Verification code</label> <input id="signup-code" type="text" inputmode="numeric" autocomplete="one-time-code" pattern="[0-9]{6}" maxlength="6" required /> <button id="verify-code" type="submit">Confirm signup</button></form>
<p id="signup-status" role="status" aria-live="polite"></p>
<script> const baseUrl = "https://yourgame.firstlook.gg"; const signupForm = document.querySelector("#signup-form"); const verifyForm = document.querySelector("#verify-form"); const emailInput = document.querySelector("#signup-email"); const codeInput = document.querySelector("#signup-code"); const sendButton = document.querySelector("#send-code"); const verifyButton = document.querySelector("#verify-code"); const status = document.querySelector("#signup-status"); let challengeId = null; let captchaId; let busy = false;
async function post(action, body) { const response = await fetch(`${baseUrl}/api/embedded-signup/${action}`, { method: "POST", credentials: "omit", headers: { "Content-Type": "application/json" }, body: JSON.stringify(body), }); const result = await response.json().catch(() => null); if (!response.ok) { throw new Error(result?.error ?? `Signup failed (${response.status}).`); } return result; }
function setBusy(value) { busy = value; sendButton.disabled = value; verifyButton.disabled = value; }
function showComplete(result) { signupForm.hidden = true; verifyForm.hidden = true; status.textContent = result.created ? "You're signed up. Thank you!" : "This email is already registered."; }
function resetCaptcha(message) { grecaptcha.reset(captchaId); setBusy(false); if (message) status.textContent = message; }
window.initSignupCaptcha = () => { captchaId = grecaptcha.render("signup-captcha", { sitekey: "YOUR_FIRSTLOOK_RECAPTCHA_SITE_KEY", size: "invisible", callback: async (captchaToken) => { try { const result = await post("start", { email: emailInput.value, captcha_token: captchaToken, redirect_uri: location.href, }); challengeId = result.challenge_id; codeInput.value = ""; verifyForm.hidden = false; status.textContent = "Check your email for a code or confirmation link."; codeInput.focus(); } catch (error) { status.textContent = error.message; } finally { resetCaptcha(); } }, "expired-callback": () => resetCaptcha("Please try sending the email again."), "error-callback": () => resetCaptcha("reCAPTCHA failed. Please try again."), }); sendButton.disabled = false; };
signupForm.addEventListener("submit", (event) => { event.preventDefault(); if (busy) return; setBusy(true); status.textContent = "Sending verification email…"; grecaptcha.execute(captchaId); });
verifyForm.addEventListener("submit", async (event) => { event.preventDefault(); if (busy || !challengeId) return; setBusy(true); try { const result = await post("verify", { challenge_id: challengeId, code: codeInput.value.trim(), }); showComplete(result); } catch (error) { status.textContent = error.message; } finally { setBusy(false); } });</script><script src="https://www.google.com/recaptcha/api.js?onload=initSignupCaptcha&render=explicit" async defer></script>The start response includes a challenge_id and expires_in in seconds. Keep the ID for the matching verification request, and keep the code as a string so leading zeros are preserved. Codes expire after 10 minutes and allow up to five attempts. Sending another email for the same address replaces the previous attempt; use the latest email and challenge ID.
A successful verification returns { "created": true } for a completed new signup, or { "created": false } when the email is already registered. Existing players keep their current role. Completing signup doesn’t log the player into FirstLook in your browser.
Confirmation links and returning to your site
Section titled “Confirmation links and returning to your site”The verification email also contains a link to a FirstLook confirmation page. The player confirms there, then returns to the redirect_uri you supplied to start. The return URL must have the same origin as the page that started signup. If you omit it, FirstLook shows its own confirmation result instead.
FirstLook adds embedded_signup_challenge to the return URL. To show a success message on your site after the player follows the link, add this code inside the example’s first <script> block, after the form handlers:
async function checkConfirmation() { const url = new URL(location.href); const id = url.searchParams.get("embedded_signup_challenge"); if (!id || busy) return; try { const result = await post("status", { challenge_id: id }); if (typeof result?.created !== "boolean" || busy) return; showComplete(result); url.searchParams.delete("embedded_signup_challenge"); history.replaceState(history.state, "", url); } catch { // A status check can be retried when the player returns to the tab. }}
void checkConfirmation();window.addEventListener("focus", checkConfirmation);The status endpoint returns null while there is no recorded completion. Completion results are available for 24 hours and can only be read from the origin that started signup. Treat the query parameter as an ID to check, rather than proof of a completed signup.
Before you launch
Section titled “Before you launch”- Test from each allowed origin, including your production hostname and any preview or local development origin you use.
- Try both entering a code and following the email link, including opening email on another device.
- Check that a new player appears with your Embedded Signup role, and that an existing player’s role stays the same.
- Show a clear message for a closed signup, expired code, CAPTCHA failure, or network error. For a
400invalid or expired code, let players request a fresh email. A403withcode: "SIGNUPS_CLOSED"means Allow signups is off. A browser CORS error usually means the page’s origin is missing from Website origins; a404can mean feature access isn’t enabled or the game is configured to require an invite.