Started authenticate function