In my case, I was going nuts since there wasn't any issues with the string to be decoded, since I could successfully decode it on online tools.
Until I found out that you first have to decodeURIComponent
what you are decoding, like so:
atob(decodeURIComponent(dataToBeDecoded));