Big News: Socket raises $60M Series C at a $1B valuation to secure software supply chains for AI-driven development.Announcement
Sign In

facegate-react

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

facegate-react

FaceGate React component — face auth in 3 lines of code.

latest
Source
npmnpm
Version
0.3.0
Version published
Maintainers
1
Created
Source

@facegate/react

Drop-in face authentication component for React. Add face login in 3 lines of code.

Install

npm install @facegate/react @facegate/client

Quick Start — Supabase App

import { FaceGate } from '@facegate/react'

function LoginPage() {
  return (
    <FaceGate
      apiKey="fg_live_your_key"
      provider="supabase"
      onAuthenticated={(session) => {
        // session.token — FaceGate JWT
        // session.user — { id, name, role }
        // session.provider_session — Supabase access_token + refresh_token
        // Use session.provider_session to set the Supabase client session
      }}
    />
  )
}

That's it. The component handles:

  • Camera permission request
  • Camera feed display
  • Liveness challenge (blink, turn, nod)
  • Face verification
  • Session creation with Supabase
  • QR code fallback if no camera
  • Loading, error, and success states

For full Supabase integration (sets the session automatically):

import { FaceGate } from '@facegate/react'
import { createFaceGateSupabaseClient } from '@facegate/supabase'

const supabase = createFaceGateSupabaseClient({
  supabaseUrl: 'https://your-project.supabase.co',
  supabaseAnonKey: 'your-anon-key',
})

function LoginPage() {
  return (
    <FaceGate
      apiKey="fg_live_your_key"
      provider="supabase"
      onAuthenticated={async (session) => {
        // Sets the Supabase session automatically
        await supabase.auth.setSession({
          access_token: session.provider_session.access_token,
          refresh_token: session.provider_session.refresh_token,
        })
        // Now use supabase client normally — RLS works
        window.location.href = '/dashboard'
      }}
    />
  )
}

Props

PropTypeDefaultDescription
apiKeystringrequiredYour FaceGate API key
onAuthenticated(session) => voidrequiredCalled on successful auth
provider'supabase' | 'auth0' | 'firebase'noneAuth provider for session creation
providerConfigRecord<string, unknown>{}Provider-specific config
baseUrlstringhttps://api.facegate.ioFaceGate server URL
confidenceThresholdnumber95Minimum match confidence (0-100)
challengeTimeoutnumber30000Liveness timeout in ms
autoStartbooleantrueAuto-start on mount
classNamestringnoneContainer CSS class
styleCSSPropertiesnoneContainer inline styles

Hooks (Custom UI)

Build your own UI using the hooks:

import { useFaceGate, useCamera, useLiveness } from '@facegate/react'

function CustomLogin() {
  const fg = useFaceGate({
    apiKey: 'fg_live_...',
    provider: 'supabase',
    onAuthenticated: (session) => { /* ... */ },
  })

  return (
    <div>
      {fg.mode === 'camera' && <video ref={fg.videoRef} autoPlay playsInline muted />}
      {fg.mode === 'qr' && <img src={fg.qrDataUrl} />}
      {fg.mode === 'success' && <p>Welcome, {fg.session.user.name}</p>}
      {fg.mode === 'error' && <button onClick={fg.retry}>Retry</button>}
    </div>
  )
}

Sub-Components

For partial customization, use individual components:

ComponentDescription
<CameraView>Video feed + liveness overlay
<QRView>QR code display + waiting state
<LivenessPrompt>Challenge instruction display
<PermissionsGate>Camera permission request UI
<StatusDisplay>Loading, success, error states

Styling

The component uses inline styles by default (no CSS import needed). Override with:

<FaceGate
  className="my-face-gate"
  style={{ maxWidth: '500px', borderRadius: '16px' }}
  apiKey="fg_live_..."
  onAuthenticated={handleAuth}
/>

Browser Support

Works in all modern browsers with camera API support: Chrome, Firefox, Safari, Edge. On devices without cameras, automatically falls back to QR code.

Keywords

facegate

FAQs

Package last updated on 23 Mar 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts