sn_auth.GlideJWTAPI() is adding additional JSON values other than specified

Brad59
Giga Guru

I have a JWT Provider and I am generating JWT tokens using the GlideJWTAPI. The tokens generate fine but I only have one JSON value in my header variable but the generateJWT function adds an additional value. This value breaks authentication because the vendor server does not accept this value in the header.

var jwtAPI = new sn_auth.GlideJWTAPI();
var headerJSON = {"alg":"RS256"};
var header = JSON.stringify(headerJSON);

//...
//...

var jwt = jwtAPI.generateJWT(jwtProviderSysId, header, payload);

The base64 value that is generated by the generateJWT function is:

{"alg":"RS256","typ":"JWT"}

EDIT
Additionally, the payload value has a jti value added that I did not include:

{
	"aud": "<url>",
	"scope": "<string>",
	"iss": "<issValue>",
	"exp": 1643747002,
	"iat": 1643746942,
	"jti": "1c6683b9-3a47-4809-a5ec-5320c48a7b65"
}
1 ACCEPTED SOLUTION

Brad59
Giga Guru

After further research, I determined that this particular vendor does not care if those extra values are present as long as the required values are still there.

View solution in original post

5 REPLIES 5

Did you get any help from ServiceNow on this? I'm seeing 'kid' added to the header section which breaks my authentication.