← Files FingerprintARCHIVED FILE

skills/fingerprint-nextjs/snippets/server-action.ts

541 Bytes · Oct 2, 2026 · 00:25 UTC

↓ Download file

// app/actions.ts — same verification from a Server Action instead of a Route Handler.
// The client calls this action and passes the event_id from getData() as an argument.
'use server'

import { verifyEvent } from '@/lib/fingerprint-server'

export async function login(formData: FormData, eventId: string) {
  const check = await verifyEvent(eventId)
  if (!check.ok) {
    return { ok: false as const, reason: check.reason }
  }

  // ...proceed; bind check.visitorId to the account, then run login...
  return { ok: true as const }
}

SHA-256: 02a77e009882954afa8edd91baf35fd2a66897e90b33a4eecfb56199da5631dd