Also extracts whole user authentication process to reduce duplication.