Fix auth sequence using postgres