Issue when validating the JWT token

1,332 views
Skip to first unread message

Javed Ali

unread,
Nov 18, 2020, 4:12:49 AM11/18/20
to Data at the Point of Care Community
Hi,

I am getting the below error when validationg the jwt token
{
    "code": 500,
    "message": "There was an error processing your request. It has been logged (ID 1e7462b5606b4899)."
}

tried multiple time with different tokens

Regards,
Javed Ali

Jon Fulk

unread,
Nov 18, 2020, 10:18:41 AM11/18/20
to Data at the Point of Care Community
Hi Javed,

The error you are seeing is due to the following exception: iDecodingException: Illegal base64url character: '"' which means that there is a double-quotation mark in the wrong place.

I was able to create a JWT using the JWT Tool from our website and successfully validate it using the curl command found in our documentation here: https://dpc.cms.gov/docs#validate-a-json-web-token-for-dpc

If you do not have the latest version of our JWT Tool, please visit the User Guide and download the new version using the blue button on the bottom left. This will allow you to create valid JWTs locally.

Please let us know if you run into any further issues.

Thanks,

Jon Fulk
DPC API Engineer

Javed Ali

unread,
Nov 18, 2020, 10:36:05 AM11/18/20
to Data at the Point of Care Community
Dear Jon,

Thanks for your response.
I still unable to solve this issue, also unable to find any '"' in the request token. Might be I am sending the token wrongly in the request. I am unable to attach the postman screen shot, your help will be appreciated.

 I am sending the token in body in postman request  like "raw":"JWT_token" in text format.


Thanks,
Javed Ali

Jon Fulk

unread,
Nov 18, 2020, 11:01:33 AM11/18/20
to Data at the Point of Care Community
Hi Javed,

If you have not already done so, you can now download a copy of our sample Postman Collection here using the blue button on the bottom left-hand side of the screen.

The sample request for validating a JWT can be found in our sample collection under: Security: Authentication > Access Tokens > Validate Javascript Web Token (JWT).

If you look at the body of that request, you will see that the settings are `raw` and `text` as you describe, but the entire body of the request is simply the value of the JWT that you created. There is no need for a key/value pair as this is not expecting a JSON object in the body of the request.

You can entirely replace {{jwt_token}} with just your JWT, and it should validate for you, assuming your JWT is valid.

Feel free to reach out again if you have more questions, but please be sure not to send any private information such as the value of your JWT either in text or in screenshots.

Thanks,

Jon Fulk
DPC API Engineer

Javed Ali

unread,
Nov 18, 2020, 11:49:40 AM11/18/20
to Data at the Point of Care Community
Hi Jon,

I am able to validate the token successfully, but getting the below error within few min (may be 1-2 min only), what is the expire time for the token?

 "code": 400,
 "message": "JWT is expired"

Regards,
Javed Ali

Jon Fulk

unread,
Nov 18, 2020, 2:09:47 PM11/18/20
to Data at the Point of Care Community
Hi Javed,

It sounds like you are making progress! The JWT and the access token both expire every 5 minutes, which is probably why you received that error message.
To facilitate testing, our Postman Collection has a collection-level pre-request script which uses your keys and client token to generate a new JWT and access token on the fly before each request is made. You can download a copy of our sample Postman Collection here using the blue button on the bottom left-hand side of the screen.

Hopefully this solves your problem, but feel free to reach out if you encounter anything else!

Thanks,

Jon Fulk
DPC API Engineer

Javed Ali

unread,
Nov 26, 2020, 10:22:55 AM11/26/20
to Data at the Point of Care Community
facing below issue when trying to get access token in postman

There was an error in evaluating the Pre-request Script:  ReferenceError: KJUR is not defined  

please help.

Regards,
Javed

Jon Fulk

unread,
Nov 30, 2020, 10:16:45 AM11/30/20
to Data at the Point of Care Community
Hi Javed,

The error you are seeing indicates that you have not imported the `globals` file into your Postman collection. This contains a small library that is used for signing your JWT with your private key prior to exchanging it for an access token. When you download the Postman collection from our user guide and then unzip that file, you will see that the resulting directory contains 3 files, one of which is called `DPC_API.postman_globals.json`. That file contains the `globals` that the pre-request script is looking for. You need to import all three of those files into Postman and also update your keys in the Postman environment as described here in order for the pre-request script to retrieve the access token needed for subsequent requests.

Please let us know if you have any other questions!

Jon Fulk
DPC API Engineer

Richard Heras (rheras)

unread,
Feb 14, 2024, 6:20:07 AMFeb 14
to Data at the Point of Care (DPC) Community
Thank you Jon Fulk for clarifying it,
however I'm not able to suee that global library on the last versions of Postman, maybe it has changed.
However the error "Pre-request Script:  ReferenceError: KJUR is not defined" is now on my Postman (W11 x64).

Please, Any other idea?

Thanks.

Data at the Point of Care (DPC) Community

unread,
Feb 15, 2024, 5:05:38 PMFeb 15
to Data at the Point of Care (DPC) Community

Hi Richard,

Thank you for reaching out! We have updated the postman documentation available on the DPC website, where you can access a download link to the postman collection and global variables. You should be able to retry with the same process, but let us know if you run into any issues.

Best,

The DPC API Team

Please be careful not to share either Personally Identifiable Information (PII) as defined in the Privacy Act of 1974 or Protected Health Information (PHI) when communicating with our team via email or in our Google Group. In certain circumstances, CMS may ask you to provide a data file to assist us in troubleshooting a problem that you bring to our attention. In those instances, we will provide you with instructions for how to handle the transmission.

Reply all
Reply to author
Forward
0 new messages