Fix so that the authorizaion loop quits after the first success, and raises an error when out of retries