Authentication error when connecting MongoDB to Visual Studio code through connection string

If you have the correct URL, the correct user name and the correct password then you should NOT have an authentication error. So you are doing something wrong. But with the little amount of details you shared it is impossible for any of us to tell you what you are doing wrong.