If you after say a apt update can’t login. It’s just a loop. This will solve the problem
Press CTRL + ALT + F2 to enter the command line while on the login screen.
Login using your user profile. .Xauthority won’t show up if you don’t (at least it didn’t for me).
Enter ls -lah and look for .Xauthority
Ensure that .Xauthority is owned by you, not root. If where it says josi yours says root,
type sudo chown yourusername:yourusername .Xauthority.
Then you should be able to press CTRL + ALT + F7 to return to the login screen.