Move authentication.js functionality to its own authUtils.js