Skip to content

digital-identity-platform-docs


digital-identity-platform-docs / supabase/functions/accept-invitation

supabase/functions/accept-invitation

Fileoverview

Accept Invitation Edge Function

Handles the acceptance of team invitations, creating the necessary client and site memberships for the authenticated user.

Cloudflare Architecture Context

AttributeValue
Classification🔵 BACKEND-ONLY
PositionApp Backend (team management)
Receives Public TrafficNo (authenticated users only)
Latency SensitiveNo
Safe to RetryNo (creates memberships)
Failure BehaviorFail-closed (returns error)

Endpoint

POST /accept-invitation

Auth

Required - JWT in Authorization header

Remarks

  • Validates invitation token, status (must be 'pending'), and expiration
  • Checks email restriction if invitation was sent to specific email
  • Prevents duplicate memberships for the same client
  • Creates client_memberships record with invited role
  • Creates site_memberships for all sites under the client
  • Updates invitation status to 'accepted' with timestamp

Example

json
{ "token": "abc123-invitation-token" }

Interfaces

Released under proprietary license.