Banning an email or an IP rarely sticks: people make a new address, clear cookies, open a private window or switch browser. Ban the device instead. Trace gives every browser a visitorId and links browsers on the same machine under one deviceId.
What you will build: a ban list keyed by device, checked on sign-up and login.
- 1
Store the device with the account
When an account is created or signs in, save the verified
deviceIdandvisitorIdnext to it.TypeScriptconst event = await verifyEvent(eventId, { secretKey, endpoint, timeoutMs: 1500 }).catch(() => null); if (event) await db.accountDevices.upsert({ userId: user.id, deviceId: event.deviceId, visitorId: event.visitorId }); - 2
Ban the device
When you ban a user, ban every device you have seen them on.
TypeScriptconst devices = await db.accountDevices.findMany({ userId: bannedUser.id }); await db.bannedDevices.insertMany(devices.map((d) => ({ deviceId: d.deviceId, reason: 'tos', at: new Date() }))); - 3
Check every sign-up and login
Check the device, and also the other browsers Trace has linked to it.
TypeScriptconst ids = [event.deviceId, event.visitorId, ...event.linkedVisitors.map((v) => v.visitorId)]; if (await db.bannedDevices.exists({ deviceId: { in: ids } })) { return res.status(403).json({ error: 'banned' }); }linkedVisitorslists other browsers or profiles that look like this machine, each with aconfidenceand whether they shared a network. Linking needscrossBrowserturned on (the default). - 4
Investigate
Before acting on a match, list everything on the device:
Terminalcurl -H "Authorization: Bearer sk_..." https://id.example.com/v1/devices/Xk3pQ9vLmT2aR7sBn4WcYou get every browser on the device and every account seen with it.
Shared computers
Libraries, internet cafes and families share machines. Treat a device match as strong evidence, not proof: send it to review, or require extra verification, before a permanent ban.