Connecting a shaver socket
The bathroom light switch box might not have a neutral in it, and you need both a hot and a neutral to power anything.

In the US in older construction the light switch may be connected to the controlled light with a "switch loop", meaning a line hot on one connection of the switch and a switched hot on the other. The line hot and the switched hot are in  the same cable going to the box with the light fixture. One of these two wires would normally have white insulation, and so is sometimes mistaken for a neutral.

However, sometimes the line hot cable enters in the switch box and in that case there is a neutral in the switch box. In that case one can install a cable leading from the switch box to a receptacle.