server returned error on SASL authentication step: Authentication failed
I faced similar error and added --authenticationDatabase
parameter and it worked while we connecting to a remote MongoDB
Use the similar below format in your code :
$mongorestore --host databasehost:98761 --username restoreuser
--password restorepwd --authenticationDatabase admin --db targetdb ./path/to/dump/
Often we confused with parameter in the mongoexport command with "Log-In" user. The command expects "Database Username" not Log-in username. This is one possibility to input wrong user name. "Database Username" can be found in "Users" tab for a database