Added refresh tokens, cleaned up auth stuff. Added app settings keys for specifying the database directory.