why did Supabase with getClaims() rename user "id" to "sub"?
The
getClaims()
getClaims()
method returns
JwtPayload
JwtPayload
with type
RequiredClaims & { [key: string]: any}
RequiredClaims & { [key: string]: any}
, which doesn't provide TypeScript types for common Supabase JWT fields that are documented in the JWT Claims Reference.
const { data } = await supabase.auth.getClaims()data.claims.email // No TypeScript supportdata.claims.id // No TypeScript supportdata.claims.user_metadata // No TypeScript support
const { data } = await supabase.auth.getClaims()data.claims.email // No TypeScript supportdata.claims.id // No TypeScript supportdata.claims.user_metadata // No TypeScript support
The documented fields like email, phone, user_metadata, app_metadata, and is_anonymous exist at runtime but aren't typed, making developers lose autocomplete and type safety. I understand why you did it, but it doesn't make it smooth to work with.
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.