updated authenticate method