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.

No comments:
Post a Comment