Using curl/wget to download file from password protect link

I am using nextcloud 18 and I would like to know if there is a way to download a shared file from a link that it is password protected using curl or wget.
I have a shared file protected by password on this url:

When accessing that link on the browser, I am presented with this screen:

And after typing the password, the download begins.
I need to automate that process to download using command line tools like curl or wget, but I have not found a way to do it.

Note that there is no USERNAME involved in the process, just a password. So using , for example,
curl -u user:password
wont work.

This works:

curl -u “shareid:password” -H ‘X-Requested-With: XMLHttpRequest’ ‘

share id is the string after the s/ and before the /download