Why am I getting this error: Authentication Exception Authentication failed

Hi all,
I am getting these error after restarting the system. Same code is working fine in other System and Server but not in my local system.
Php version: 7.3.12
MongoDB shell version v4.2.8

Fatal error: Uncaught MongoDB\Driver\Exception\AuthenticationException: Authentication failed. in C:\vendor\mongodb\mongodb\src\Operation\Find.php on line 322
MongoDB\Driver\Exception\AuthenticationException: Authentication failed. in C:\vendor\mongodb\mongodb\src\Operation\Find.php on line 322

All the connectivity i have checked is fine, when i tried to check commend mongo “serverdetail” from terminal with user name and password it says-

*** It looks like this is a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.

I have added IP into MongoDB Atlas cluster. Still facing error.

Hi @Swati_Bhargava … I am using PHP too but from Fedora Linux.

I had some problems connecting.

Some ideas:

  1. Can you show your code (of course ***** out your credentials)?
  2. Check Windows Firewall.
  3. Is it failing in a web server or in command-line PHP?