-
@bharbharHi, I would like to know if you can help me. Originally posted by @bharbhar in #5503 (comment) |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
@5011-5011 This should be in discussions, not submitted as an issue. I am moving it now. |
Beta Was this translation helpful? Give feedback.
-
I noted at #5503 (comment), another way to generate JWTs that uese jsrassign.. Please note the comments made at the top or the code at https://github.com/pacmano1/Mirth-Snippets/blob/main/epicJWTforBackend.js, line 6 is important, you must make a variable declaration to skip this library looking for web browser properties. That same librarry allows you do verify and decode tokens, see https://github.com/kjur/jsrsasign/wiki/Tutorial-for-JWT-verification. From the bottom of that page, showing the token header and payload in mirth can be done wiht: var sJWT = "eyJhb....." // this is the jwt
var headerObj = KJUR.jws.JWS.readSafeJSONString(b64utoutf8(sJWT.split(".")[0]));
var payloadObj = KJUR.jws.JWS.readSafeJSONString(b64utoutf8(sJWT.split(".")[1]));
$c('headerObj',headerObj)
$c('payloadObj',payloadObj) Note https://github.com/kjur/jsrsasign/wiki/Tutorial-for-JWT-verification has other things you can do with the token. Be careful with javascript vs java variables in Mirth when working with this library. I would also cache your validation of these tokens for faster performance in Mirth rather than call the librrary every time. |
Beta Was this translation helpful? Give feedback.
I noted at #5503 (comment), another way to generate JWTs that uese jsrassign.. Please note the comments made at the top or the code at https://github.com/pacmano1/Mirth-Snippets/blob/main/epicJWTforBackend.js, line 6 is important, you must make a variable declaration to skip this library looking for web browser properties.
That same librarry allows you do verify and decode tokens, see https://github.com/kjur/jsrsasign/wiki/Tutorial-for-JWT-verification.
From the bottom of that page, showing the token header and payload in mirth can be done wiht: