Encode / Decode string on MAC terminal

Share

Today i am working on a batch operation registering several sensors on IBM Watson IoT.

Using curl you need to encode de API KEY and API TOKEN

It easy using the MAC terminal console

To encode just type on terminal: echo -n ‘user:password’ | base64
the result is —> dXNlcjpwYXNzd29yZA==

To decode just type: echo ‘dXNlcjpwYXNzd29yZA==’ | base64 -D
the result is —> user:password