Add logic to retry authentication if failed