Retrieve a session

Returns the session, refreshing it if necessary. The session returned can be null if the session is not detected which can happen in the event a user is not signed-in or has logged out.

  • This method retrieves the current local session (i.e local storage).
  • If the session has an expired access token, this method will use the refresh token to get a new session.

const { data, error } = await supabase.auth.getSession()