JSON Web Tokens (JWT) Generator?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-24-2015 08:48 PM
What is the best way to generate a JSON Web Token (JWT) in ServiceNow?
There are heaps of implementations in different languages out there (i.e. JSON Web Tokens - jwt.io) and I wrote one myself in Java, but without a MID server I can't run that java code, and I don't want to use MID.
- Is there an out of the box way to generate a JWT SHA256withRSA in servicenow giving the p12 file?
- Or I could rewrite it in a script include. But I'll have to find an equivalent to some java classes java.security.PrivateKey, KeyStore, Signature,... which I couldn't find.
- The only other option that I can think of is to take one of the open source Javascript implementations, refactor it, and put it as a Script include. But it's not going to be easy.
Best also if the solution can be implemented/used in a scoped app.
Thanks,
Michel
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎02-17-2017 02:29 PM
I was get false when verifying the jwt.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-03-2017 04:25 PM
I was able to get it working(update set above) by change the if(JSUtil.notnil(p)) to the following
var answerNil;
if (JSUtil.isJavaObject(p)){
answerNil = !GlideJSUtil.isNilJavaObject(p);
}
if(answerNil == null) {
answerNil = !((p == null) || (typeof p == 'undefined'));
}
if(answerNil)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-19-2019 04:57 AM
Hello,
Looks like in New York there is an API for that: https://docs.servicenow.com/bundle/newyork-platform-administration/page/administer/security/concept/...
cheers,
Manolis.