Search code examples
oauthoauth-2.0base64padding

Ubuntu base64 encoded string ends with "o=" instead of apparently correct "=="


In the instructions on this OAuth protocol, you can see that the example base64 encoding of "12345:verySecret" is

"MTIzNDU6dmVyeVNlY3JldA=="

The problem is, when I run echo 12345:verySecret | base64I get

"MTIzNDU6dmVyeVNlY3JldAo="

During actual authentication I was banging my head against a wall until I realized I needed to change the second to last "o" character into "=" in my own encoded client_id:client_secret string. But why?


Solution

  • echo inducing newline character, try with -n flag with echo

    echo -n 12345:secret | base64