Updated with working authenticate