V22 · Auth bridge

Firebase Auth xác minh actor, không quyết định quyền dữ liệu một mình.

Custom claims giúp mở đúng vai trò, nhưng mọi thao tác đọc/ghi/export vẫn phải qua repository policy và consent scope.

Token flow

Client nhận Firebase ID token, gửi qua Authorization: Bearer <token> tới API route.

API route verify token bằng Firebase Admin SDK scaffold, sau đó chuyển thành AuthenticatedActor.

Custom claims

  • role
  • cohortIds
  • organizationId

Role từ custom claims chỉ mở route/action; consent gate vẫn quyết định dữ liệu nào được lưu, đọc, export hoặc aggregate.