Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

457 B
Raw Blame
/**
 * Headers for forwarding the caller's credentials to the platform API.
 * Returns `undefined` when there's nothing to forward.
 */
export function getAuthHeaders(
  authorization: string | undefined,
  { contentType = false }: { contentType?: boolean } = {}
): Record<string, string> | undefined {
  if (!authorization) return undefined
  return {
    ...(contentType && { 'Content-Type': 'application/json' }),
    Authorization: authorization,
  }
}