GNU's base64 -d requires proper padding (input length must be a multiple of 4). Other bash64base64 decoders may be smarter and not require padding (e.g. Mac/BSD bash64base64 -D does not require padding).
Here's a bash command that can automatically pad the base64 string properly. Then you won't get the "invalid input" error.
str="eyJmb28iOiJiYXIiLCJiYXoiOiJiYXQifQ"
echo "$str"==== | fold -w 4 | sed '$ d' | tr -d '\n' | base64 --decode
Explanation:
echo "$str"====appends 4 equal signsfold -w 4split every 4 characters into separate linessed '$ d'deletes the last line (the extraneous padding)tr -d '\n'joins all lines