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.
getSession().session.user
for faster results. getSession
is insecure on the server.Takes in an optional access token JWT. If no JWT is provided, the JWT from the current session is used.
const \{ data: \{ user \} \} = await supabase.auth.getUser()
const \{ data: \{ user \} \} = await supabase.auth.getUser(jwt)