Retrieve a user

Gets the current user details if there is an existing session.

  • This method gets the user object from the current session.
  • Fetches the user object from the database instead of local session.
  • Should be used only when you require the most current user data. For faster results, getSession().session.user is recommended.
  • jwt

    Takes in an optional access token jwt. If no jwt is provided, getUser() will attempt to get the jwt from the current session.

const { data: { user } } = await supabase.auth.getUser()