saveAuthData, refactoring, test