auth auto logic