refactor auth_set