changed function profile to retry authentication