What does the error code 401 message “Access denied due to unauthorized transaction, please check client key or server key” mean?

There are several possible scenarios:

You are using Production Access Keys while running Sandbox endpoint URL, or vice versa;
Your Server Key is not converted yet to base64;
You have space ( ) when converting.