I have a similar problem to this problem. I have to external points A and B and a sphere with radius r. I want to find out the point of tangency T. Below is the illustration:
So far I have applied the sine rule to find out the angle CAT, but not sure on how to make use of it.
Any help is appreciated.

The fact that $T$ lies on the tangent line is characterised by the existence of a real number $t$ such that $$\left(\matrix{x_3\\y_3\\z_3}\right)=\left(\matrix{tx_1+(1-t)x_4\\ty_1+(1-t)y_4\\tz_1+(1-t)z_4}\right)$$
The fact that it is the tangency point is characterised by $CT$ being orthogonal to $AB$. If you write down $$\vec{CT}\cdot\vec {AB}=0$$ you get a linear equation of degree $1$ in $t$.
The solution is $$t=\frac{(x_2-x_4)(x_1-x_4)+(y_2-y_4)(y_1-y_4)+(z_2-z_4)(z_1-z_4)}{(x_1-x_4)^2+(y_1-y_4)^2+(z_1-z_4)^2}$$