Skip to content

Decode and filter JWT #5841

Closed Answered by pacmano1
5011-5011 asked this question in Q&A
Jul 4, 2023 · 2 comments · 4 replies
Discussion options

You must be logged in to vote

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

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
4 replies
@5011-5011
Comment options

@pacmano1
Comment options

@5011-5011
Comment options

@pacmano1
Comment options

Answer selected by 5011-5011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #5840 on July 04, 2023 16:04.