For AI agents: the documentation index is at llms.txt. Guide pages have a markdown version at the same path with .md appended, before any query string or fragment.

JavaScript: getUser

Gets the current user details if there is an existing session. This method performs a network request to the Supabase Auth server, so the returned value is authentic and can be used to base authorization rules on.

Parameters

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)