Javascript Reference v2.0

Retrieve a user

Get user by id.

  • 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.
Parameters
    uid
    REQUIRED
    string

    The user's unique identifier

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


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