why did Supabase with getClaims() rename user "id" to "sub"?

The getClaims() method returns JwtPayload with type 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 support
data.claims.id        // No TypeScript support
data.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.
Was this page helpful?