refactored yggdrasil.authenticate