All that needs changing here is echo with -n.

You can also use:

echo -n "valid_user_name:valid_user_password"  | openssl base64 -base64

The -n is important as it means no newline and that is all that is the problem here. Using cURL is the wrong approach.