Skip to content

Security & Identity

B2B SaaSE-commerceMobile apps

Prevent spoofed identify calls with signed sign-ins

Sign every customer email on your server with HMAC-SHA256 and pass userHash into identify() so browser console spoofing can never corrupt existing profiles, journeys, or partner credit.

HMAC-SHA256 verification included on every Apex workspace.

6 min read15 min setupUpdated
Security engineer inspecting a heavy brass wax seal stamp and envelopes on a sunlit studio counter.
Every signed sign-in carries a server-issued HMAC seal so untrusted browser calls can never rewrite a real customer's timeline.

HMAC verification decision matrix

Test signed, unsigned, and spoofed identify() calls

Toggle Require signed sign-ins and test valid hashes, tampered emails, and console spoofing to see what attaches versus what gets held.

Illustrative workspace · Signed sign-ins policy simulator
$90,000
ApexApex · Live Playbook Simulator

Verified monthly revenue

$90,000

100% reconciled to commerce / CRM

Discovery channel credit

$52,200

+$37,800 vs last-click

Branded search / direct credit

$13,500

15% of closed revenue

Revenue credit by funnel role

Touchpoint roleLast-clickSelected modelDifference
First discovery (ads, posts, QR)$14,400$52,200+$37,800
Mid-funnel nurture (email, retargeting)$21,600$24,300+$2,700
Final branded search / direct$54,000$13,500-$40,500

Credit restored to discovery touches

$52,200

Full multi-touch path kept on one stitched customer timeline

  • Switch attribution models in one click without re-tagging links or re-importing orders.
  • Compare first-touch, linear, time-decay, and last-touch on the exact same revenue.

Stitched buyer journey

  1. Day 1Discovery touch capturedFirst touch

    Apex stores first-touch source on the visitor ID.

  2. Day 11Email click + identity stitchStitched

    Visitor signs up; anonymous session merges onto the customer record.

  3. Day 19Direct checkout closesVerified

    Revenue credits cleanly across the chosen attribution model.

The complete playbook

Step-by-step setup, worked math, and real limits.

Steps, technical details, and live pricing.

How it works without Apex

Turn on Signed sign-ins in Apex so your backend computes an HMAC-SHA256 hex digest of the user's lowercased, trimmed email using your workspace sign-in secret and passes userHash to identify(). When Require signed sign-ins is enabled, any unsigned or mismatched call is held safely so it can never overwrite an existing customer's traits, merge devices, trigger journeys, or earn partner credit.

How Apex does it for you

Apex verifies userHash on every browser and mobile identify() call, holds unverified or mismatched payloads without mutating existing contacts, flags secret-rotation mismatches on Set up Apex, and supports scoped app keys (apex_pk_) for mobile apps.

How to set this up in 5 steps

  1. Copy your workspace sign-in secret as an admin

    Open Settings, Workspace, Signed sign-ins in Apex and copy the workspace sign-in secret into your backend environment variables as APEX_SIGN_IN_SECRET. Never expose it to client code.

  2. Compute the HMAC-SHA256 hex digest on your backend

    When a user signs in, lowercase and trim their email, sign it with APEX_SIGN_IN_SECRET using HMAC-SHA256 (or signSignIn from @apex-inc/sdk), and return the hex userHash alongside the session.

  3. Pass userHash to every identify() surface

    Forward userHash in window.apex.identify(email, traits, { userHash }), @apex-inc/sdk identify(), Capacitor Apex.identify(), and React Native identify(). Apex never stores userHash as a trait.

  4. Use a scoped apex_pk_ app key in mobile binaries

    Keep server keys and the sign-in secret off mobile devices. Configure mobile apps with an apex_pk_ app key and fetch userHash from your backend after login.

  5. Enable Require signed sign-ins once every caller sends userHash

    Roll out signing first while unsigned calls still attach, verify Set up Apex shows zero hash mismatches, then flip Require signed sign-ins on to hold unsigned calls.

Why browser identify() is spoofable

Any client-side analytics call runs inside a browser the visitor controls. Without cryptographic verification, anyone can open DevTools and run window.apex.identify("ceo@example.com") to merge their own session onto another customer's timeline, trigger lifecycle emails, or claim affiliate credit on someone else's account.

Signed sign-ins close that hole with a standard HMAC-SHA256 signature. Your backend signs the authenticated user's lowercased, trimmed email using your workspace sign-in secret, and passes the hex digest (userHash) down to the browser or mobile app. Because the secret never leaves your server, nobody can forge a valid userHash for another person's email.

Two application security engineers sealing numbered cream verification envelopes at a sunlit timber bench.
Keeping your sign-in secret strictly on the server prevents browser callers from forging another user's identity.

How Apex handles each signature state

You do not need a flag-day cutover. Roll out signing across web and mobile first while Require signed sign-ins stays off, confirm zero mismatches on Set up Apex, and then enforce:

Incoming identify() callRequire signed sign-ins offRequire signed sign-ins on
Signed, hash matchesAttached to the personAttached to the person
Signed, hash does not matchHeld (flagged on Set up Apex)Held (flagged on Set up Apex)
Not signedAttached to the personHeld

A held sign-in never alters an existing contact in Apex: their devices, traits, and revenue timeline remain untouched. If the email has never been seen before, Apex keeps the new profile out of Adaptive Journeys, partner credit, and scoring until a valid signed sign-in confirms them. A signed form submit also qualifies as a verified lead for Meta and LinkedIn, even when sent from a mobile app with no website origin to inspect.

Server signing and mobile app keys

Compute userHash in one line on your server (Node, Python, or Ruby):

import { signSignIn } from "@apex-inc/sdk";

// Inside your authenticated session handler
const userHash = await signSignIn(process.env.APEX_SIGN_IN_SECRET!, user.email);

Then pass userHash into whichever client surface signs the user in:

// Browser snippet
window.apex.identify(user.email, { name: user.name }, { userHash });

// TypeScript SDK
identify(user.id, { email: user.email, userHash });

// Capacitor mobile app
await Apex.identify({ email: user.email, userId: user.id, userHash });

Apex checks userHash at ingest and discards it immediately; it is never saved as a contact trait.

Mobile product developer testing an iOS sign-in flow on a matte black phone while standing by a sunlit studio window.
Mobile apps ship with a scoped apex_pk_ key and fetch userHash from your backend after sign-in so secrets never sit inside app binaries.
Mobile binary hygiene: Never bundle APEX_SIGN_IN_SECRET or a server key (apex_sk_) inside an iOS or Android app. Ship a scoped app key (apex_pk_) for app traffic and return userHash from your backend API on login. An app key can add a new contact, but it can never overwrite an existing person, count revenue, or send events to ad platforms.

What this costs on Apex

Live Apex pricing · Pay-as-you-go

Estimated Apex cost for Web and mobile SaaS app verifying 35,000 signed sign-ins per month

$0 / month

Covered by monthly free allowances.

Apex meter / scheduleScenario volumeFree allowance / basisRateApex cost
Events
Signed browser and mobile identify() calls (35,000 authenticated sign-in verifications per month)
35,000 / mo1M / month$5 per 100K events$0

Signed sign-ins and scoped apex_pk_ app keys are built into every workspace with no security add-on charge. History: 13 months no card, 3 years with card, 7 years once you've paid an invoice. Live pricing.

Signed sign-in verification and scoped app keys are built into every workspace with zero security tier upgrade or per-verification surcharge.

Audit with your AI agent

Verify every identify() call passes userHash before turning on enforcement

Before flipping Require signed sign-ins in Workspace Settings, ask your coding agent to check your repo and inspect Set up Apex for any hash mismatch alerts.

1Add Apex to your editor

Install in Grok Build

Opens Grok Build and adds Apex. Nothing to configure.

2Tell your agent

Prompt for your AI editor

Search this codebase for every call to apex.identify or Apex.identify to verify each one passes a backend-generated userHash, then call get_setup_state in Apex to confirm no signed sign-in hash mismatch warnings appear.

The first time your agent calls Apex, it gives you a link to approve in the browser. There is no key to paste. In Grok Build you can also run /setup-apex.

See how editor setup works step by step

web-and-mobile-app · Grok BuildWaiting for approval
Agent
You

Set up Apex in this repo.

Set up Apex · 0 of 4
  • Signed in
  • Workspace named
  • Events arriving
  • Conversion picked
  • Stripe

Your move

Stop letting browser console calls rewrite customer identity.

Mint userHash on your server, roll out with zero downtime, and require signatures once every client sends them.