If anyone is looking to use base64url encoding in the terminal.
One can simply do the following:
echo -n 'string' | base64 | tr '/+' '_-' | tr -d '='