- Refactor to be more in line with the other auth scripts
- Add tests