๐ How to Generate JWT CID Token with SHA256 Hash in Oracle Integration Cloud (OIC)
๐งฉ Use Case
As part of secure API integration with HSBC (or any financial institution requiring strict identity/authentication enforcement), the client must send a JWT (JSON Web Token) as a CID (Client Identification Token) in the Authorization header of each API request. This token includes a signed hash (SHA-256) of the payload body to ensure message integrity.
This post walks you through how to:
- Construct the JWT token using base64 encoded header and payload.
- Generate the SHA256 hash of the payload body.
- Sign the token using a private key and java oci function.
- Assemble and use the CID token in OIC integration.
Overall high level Steps:
- Authorization :
JWS <CID Token> - Accept-Language :
en-GB - Content-Type :
application/json
Custom:- X-Forwarded-For :
<IP Address> Metadata/Environment/baseURL - X-HSBC-Chnl-CountryCode :
HK - X-HSBC-Chnl-Group-Member :
HBAP - X-HSBC-Global-Channel-Id :
PARTNER - X-HSBC-Request-Correlation-Id : JTI
- X-HSBC-Client-Id :client name
Request:
JWS <CID Token> en-GB application/json <IP Address> Metadata/Environment/baseURLHK HBAPPARTNERStep2: Generate CID JWT token.
๐️ JWT Structure
Format:
JWT token =BASE64URL(JWTHeader) + "." + BASE64URL(JWT Body) + "." +BASE64URL(Signature)
๐ OIC Implementation Steps
- Configure trigger for common service to generate token
- Write payload data required for hashing
- Write JWT Header data
- Write JWT Body data with hashing
- Remove base64 padding training chars from JWT header and body data
- Call the common function to create signature
- Generate JWR token and share
For iat : use below blog to generate teh unix time.
https://soalicious.blogspot.com/2025/04/oic-converting-normal-datetime-to-unix.html
Step5: Remove base64 padding training chars from JWT header and body data
See my below blog for more details:
https://soalicious.blogspot.com/2026/08/oic-removing-base64-padding-for-jwt.html
Step6: Create signature(sign/verify):
Messgae passed as concat of "encode base64 url jwt header data" , "." ,"emcode base64 url jwt body data"
Step7: create JWT token and send back as resposne to the caller service.
Jwt token : base64 url(header) . Base64url(body).Base64Url(signature)
Payload message: same sent as received in step2
Follow below blog for java function code - sign / verify using RSA private and public key pair.
https://soalicious.blogspot.com/2026/04/oic-rsa-sign-and-verify-java-code-for.html
✅ Final Output
A complete CID token is structured like:
JWS eyJ2ZX...<Header>.eyJzdW...<Payload>.X1c8Cp...<Signature>
It is passed to the Authorization header like:
Authorization: JWS eyJ2ZX...<Signature>
๐งช Testing & Validation
- Use Postman or SoapUI to validate the generated JWT.
- Tools like jwt.io help decode and verify token.
- Ensure OIC has access to private key and correct time sync for
iat.

















No comments:
Post a Comment