Skip to main content
Version: v2 RC

getUser()

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

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

Parameters

  • jwtoptionalstring

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

Notes

  • This method gets the user object from the current session.
  • Fetches the user object from the database instead of local session.

Examples

Get the logged in user with the current existing session

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

Get the logged in user with a custom access token jwt.

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