before refactor auth