© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
SupabaseS
Supabase•4y ago•
24 replies
Bob

NodeJS Backend - updateUserById

I try to do the following(use-case 1):

const {data: {user, error}} = await supabase.auth.getUser(jwt);

const resp = await supabase.auth.admin.updateUserById(user.id,{ app_metadata: { isBeta: true } })

First Call for auth.getUser(jwt) works fine, second call for aut.admin.updateUserById(...) isn't working and I receive back a 401 that I'm not authorized and yes I use the service role in backend.

When I then try to do onlny as example the following(use-case 2):

const resp = await supabase.auth.admin.updateUserById(<USER_ID>,{ app_metadata: { isBeta: true } })

It works fine and the app_metadata gets updated correctly. Can somebody tell me why "use-case 1" above isn't working correctly or how I can debug on that?
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

auth.updateUser vs auth.admin.updateUserById
SupabaseSSupabase / help-and-questions
4y ago
Slow auth actions under load (generateLink, verifyOtp, updateUserById)
SupabaseSSupabase / help-and-questions
4y ago
supabase backend
SupabaseSSupabase / help-and-questions
4mo ago
Supabase Backend
SupabaseSSupabase / help-and-questions
3y ago