getUser() vs getClaims()

Hey guys,

Previously when we were using
getUser()
, we would also cache it like:

export const user = cache(async () => {
    const supabase = await supabaseServerClient()
    const { data } = await supabase.auth.getUser()
    return data.user?.role
})


Is this still relevant when using getClaims()?

export const claims = cache(async () => {
    const supabase = await supabaseServerClient()
    const { data } = await supabase.auth.getClaims()

    if (!data) return null

    const claims = data.claims
    return claims
})


Thanks for your help!
Was this page helpful?