getting and saving credentials properly