WSL2 Ubuntu snap not working

I want to install VScode. However when I typed sudo snap install --classic code it is showing error: access denied (see 'snap help login')

systemctl status snapd.service is returning the following:-

● snapd.service - Snap Daemon
     Loaded: loaded (/lib/systemd/system/snapd.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2022-07-18 12:21:18 IST; 10min ago
TriggeredBy: ● snapd.socket
   Main PID: 689 (snapd)
      Tasks: 18 (limit: 7474)
     Memory: 44.4M
     CGroup: /system.slice/snapd.service
             └─689 /usr/lib/snapd/snapd

(Yes systemctl does not work by default in WSL2, but I found a way to enable it)

snap version is returning the following

snap    2.48+20.04
snapd   2.48+20.04
series  16
ubuntu  20.04
kernel  5.10.102.1-microsoft-standard-WSL2

sudo snap refresh snapd isn’t working too. Giving the same error as of snap install

Please help!