Friday, August 7, 2026

OIC - Removing Base64 Padding (=) for JWT Generation in Oracle Integration Cloud (OIC)

When generating a JWT in Oracle Integration Cloud (OIC), the header and payload must be Base64URL encoded before creating the signature. Standard Base64 encoding adds = characters as padding to make the encoded string a multiple of four characters. However, the JWT specification does not allow these padding characters.

To remove the padding, use the following expression in an Assign action:

replace(encodeReferenceToBase64(FileReference), '=', '')

How It Works

encodeReferenceToBase64(FileReference) encodes the input into a standard Base64 string.

replace(..., '=', '') removes all = padding characters from the encoded value.

The resulting string is then used as the JWT header or payload before generating the signature.


Why Is This Required?

JWT uses Base64URL encoding, which differs from standard Base64 by:

Removing the = padding characters.

Using URL-safe characters (- and _) instead of + and / (if applicable).

Removing the padding ensures that the generated JWT follows the standard specification and can be successfully validated by external applications and APIs.

Using this simple expression helps generate JWT-compliant header and payload values directly within OIC, without requiring any additional custom code.

OIC - Generate SHA-256 Checksum Using JavaScript in OIC

Oracle Integration Cloud (OIC) provides a built-in checksum function to generate a SHA-256 hash without using any external library. This is useful when creating request signatures or validating message integrity.

JavaScript Action (SHA256Generator.js)

function checksum_sha256(inputStr) {
    var sha256_result = oic.checksum.sha256(inputStr, "sha-256");
    return sha256_result;
}

Use Cases

Generate SHA-256 checksum for REST requests.

Create secure hash values for authentication.

Verify message integrity before sending data.

This reusable JavaScript action can be called from any OIC integration whenever a SHA-256 checksum is required.

Reference:

https://docs.oracle.com/en/cloud/paas/application-integration/integrations-user/import-library-file.html#GUID-D9638CD4-ADCE-4C8A-B5B3-1969086E642E

Featured Post

OIC - Removing Base64 Padding (=) for JWT Generation in Oracle Integration Cloud (OIC)

When generating a JWT in Oracle Integration Cloud (OIC), the header and payload must be Base64URL encoded before creating the signature. Sta...