The example in question from https://danbooru.donmai.us/wiki_pages/help:api:
curl --header "Authorization: Basic $(echo $username:$api_key | base64)" https://danbooru.donmai.us/profile.json
The echo
command adds a new line at the end of it's argument. So echo $username:$api_key | base64
actually pipes a new line as part of the argument to base64
and the encoded key is not actually what it should be. This caused me a bit of headache when I was trying to debug a script.
Updated