added basic auth loop