All Collections
PassKit API
"Token used before issued" Error
"Token used before issued" Error

How to resolve the API call error "token used before issued"

Claudia avatar
Written by Claudia
Updated over a week ago

Sometimes, when using a token to access a system or perform certain tasks, you may encounter an error message indicating that the token time is incorrect. This means that the time when the token was created doesn't match the current time. Here are two common reasons for this issue and how you can resolve them:

  1. Incorrect Server Time:

    One reason for the token time error is that the clock on the server where the token is being processed is incorrect or out of sync. To fix this, you can install a program called NTP (Network Time Protocol) on your server. NTP will help synchronise the server's time accurately with the correct time.

  2. Token Creation Time Issue:

    The other reason for the error is related to how the token's creation time is set. When a token is generated, it includes a timestamp called "iat" (issued at) that shows when the token was created. It's important to ensure that the code responsible for setting this timestamp captures the current time accurately, without rounding up. Additionally, check if there are any subsequent steps in the process that inadvertently cause the "iat" value to be rounded up.

If you have confirmed that the "iat" value is not being rounded up and the error persists, you can try setting the token's issuance time to be up to a minute earlier than the current time. This adjustment should resolve the error. However, it is recommended to attempt the solutions mentioned above before setting the time to be in the past.

Remember, it's crucial to ensure that the token's creation time is accurate and consistent, so that there are no discrepancies between when it was issued and when it is being used.

Did this answer your question?