Hi,
The solution with the external known resistor only works if the internal impedance is also purely resistive.
If you want to know the impedance, then you need a second function generator and connect both outputs together with a known resistor. Switch both function generators ON, but the DUT should actively drive zero. Let the second generator output different frequencies (or sweep) and measure both voltages before and after the resistor.
With these values you can calculate voltages, currents and phase shifts. All you need for calculating the impedance.
Klaus