Got auth working. Then moved it to a separate module. Now there are
scoping issues, but I need to commit and go to bed. Will fix later.