Here is what helped me, where nothing else worked: (Basically Close Minecraft launcher > open Xbox Game Bar (press Windows and type that app name, then open it), in Settings > Accounts I have signed out, then reopened Minecraft):
Here is what helped me, where nothing else worked: (Basically Close Minecraft launcher > open Xbox Game Bar (press Windows and type that app name, then open it), in Settings > Accounts I have signed out, then reopened Minecraft):