Skip to main content
Version: v2 RC

getUserById()

Get user by id.

const { data, error } = await supabase.auth.admin.getUserById(1)

Parameters

  • uidrequiredstring

    The user's unique identifier

    This function should only be called on a server. Never expose your service_role key in the browser.

Notes

  • Fetches the user object from the database based on the user's id.
  • The getUserById() method requires the user's id which maps to the auth.users.id column.

Examples

Fetch the user object using the access_token jwt.

const { data, error } = await supabase.auth.admin.getUserById(1)