I have resolved the issue:
You need to create the password by specifying the realm as follows:
htdigest -c .htpasswd realmyouwanttoset username_setted
Enter password: pwfantasy
Retype password: pwfantasy
Then, you can set the arguments as shown below:
SWUPDATE_WEBSERVER_ARGS=" -r /srv/swupdate/mongoose-webapp -p 8081 --auth-domain realmyouwanttoset --global-auth-file /whereyourfileis/.htpasswd "
Basic authentication configured successfully. 📈📈