ServiceNow Widget Debugging: Temporarily Set Any Field Value (Without Touching Code)
Let’s be honest… Service Portal debugging is slow. Every small change = 👉 Update script 👉 Save 👉 Reload 👉 Navigate back 👉 Test again Repeat that 10 time...
In this article I will take you through from certificate creation till generating an encrypted JWT payload in ServiceNow. We can use this JWT payload for secure data transfer.
There are many articles and blogs on what JWT is and how to use it in ServiceNow if we already have a certificate and a key. However, if you want to do both of these by yourself then this article is for you.
JKS – Java Key Store
JWT – JSON Web Token
SSO – Single Sign On
PKCS12 – A cryptographic archive file format
Step1: Arrange all the prerequisites
Step2: Generate a JKS file
Step3: Configure JWT in ServiceNow
Step4: Generate a JWT for a sample payload
After the above 4 steps you will have a JWT ready, and you can transfer this data based on your requirement.
In this topic we are generating our own certificate and keys to configure JWT in ServiceNow. To achieve this, below are the 3 prerequisites.
We are generating JKS file using below 3 step approach
Below is a sample script to generate JWT of a sample payload using GlideJWTAPI
var jwtAPI = new sn_auth.GlideJWTAPI();
var headerJSON = { typ: "JWT", alg: "RSA256"};
var header = JSON.stringify(headerJSON);
var payloadJSON = { "employeeNumber": gs.getUser().getID()};
var payload = JSON.stringify(payloadJSON);
var jwtProviderSysId = "0d6ed1f02fe011105123b2e72799b638";
var jwt = jwtAPI.generateJWT(jwtProviderSysId, header, payload);
gs.info("JWT:" + jwt);
Test your generated JWT by decoding it using https://jwt.io

Written by
Let’s be honest… Service Portal debugging is slow. Every small change = 👉 Update script 👉 Save 👉 Reload 👉 Navigate back 👉 Test again Repeat that 10 time...
If you’ve worked with Multi-Row Variable Sets (MRVS) in ServiceNow, you’ve probably seen this requirement come up: “Allow users to add rows sometimes… but rest...
Learn how to embed the ServiceNow Virtual Agent in any website using the Portable Web Client, with support for SSO, CORS, and custom branding. Includes code sam...