code: public static byte[] decodeBase64(String base64String) {
      try {
        return BaseEncoding.base64().decode(base64String);
      } catch (IllegalArgumentException e) {
        if (e.getCause() instanceof DecodingException) {
          return BaseEncoding.base64Url().decode(base64String);
        }
        throw e;
      }
    }
docs: Decodes a Base64 String into octets. Note that this method handles both URL-safe and
  non-URL-safe base 64 encoded strings.
  
  @param base64String String containing Base64 data or {@code null} for {@code null} result
  @return Array containing decoded data or {@code null} for {@code null} input