Add a preauth method
Fix tests