Running Firefox as root in a regular user's session is not supported. ($XAUTHORITY is /run/user/1000/gdm/Xauthority which is owned by radix.)
earthmeLon's warning is very important, and you should try to solve your problem without having to run Firefox as root
.
However, if for some reason you really need to do that (I won't judge you), you can do this:
sudo -i
To start a root shell, then make a backup of root's .Xauthority
if needed
test -f .Xauthority && mv .Xauthority .Xauthority.bak
Copy the file from your home to root's
cp -a /home/youruser/.Xauthority .Xauthority
chown root: .Xauthority
Then you can start Firefox with:
XAUTHORITY=/root/.Xauthority sudo firefox
Remember to exit
the root shell when you've finished with it.
Also remember to unroll your .Xauthority
backup when done:
sudo -i
test -f .Xauthority.bak && mv .Xauthority.bak .Xauthority
exit