© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•5mo ago•
9 replies
Rob Schilder

getUser() vs getClaims()

Hey guys,

Previously when we were using
getUser()
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
})
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()
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
})
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!
Supabase banner
SupabaseJoin
Supabase gives you the tools, documentation, and community that makes managing databases, authentication, and backend infrastructure a lot less overwhelming.
45,816Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

getUser() vs getClaims()
SupabaseSSupabase / help-and-questions
2mo ago
getClaims returning null
SupabaseSSupabase / help-and-questions
4mo ago
getClaims and typescript
SupabaseSSupabase / help-and-questions
7mo ago
getClaims in supabase ssr
SupabaseSSupabase / help-and-questions
4mo ago