How to verify the validity of SafeQod (formerly Ubiqod Key) token?

How to verify the validity of SafeQod (formerly Ubiqod Key) token?

When a user scans SafeQod (formerly Ubiqod Key), the Ubiqod platform ensures that this scan is legitimate.

There are 2 cases to distinguish:
  1. You are using an interface created on the Ubiqod platform: validation is performed automatically
  2. You redirect the user to your own interface: a token is sent in the URL, and its validity can be verified via an API route

This article explains how to use this validation API endpoint to add proof of presence to your own form or application via a redirect.

Adding the validation token to the URL

To redirect users to your own interface, create a Redirection type interface:



Then enter the URL of your interface, and check the Validation token box:



Info
We recommend that you check Tracker serial number to strengthen verifications (see Verifying token validity section)
The URL preview (Redirection example) allows you to preview the parameters that will be added.

If you wish to change the default parameter name, uncheck Validation token and add the parameter using the advanced options:



Verifying token validity

API call

You need to retrieve the token content and the serial number of the issuing SafeQod (formerly Ubiqod Key) from the redirected URL parameters.

You can then verify the validity of the token by calling the GET route: https://k.ubiqod.com/key/validatetoken

As with a standard API call, you will need to pass your API key in the header, in an X-API-KEY property ({X-API-KEY: <<your-api-key>>})

The token must be passed in the token URL parameter (token=<<your-token>>)

Info
Complete URL example (excluding header): https://k.ubiqod.com/key/validatetoken?token=<<your-token>>

Server response

In case of success, the server response will be in the form (code 200):
  1. {
  2.     "tokenData": {
  3.         "creationDate": "2021-02-04T15:10:32.157Z",
  4.         "trackerLabel": "Test device",
  5.         "trackerName": "UK12346"
  6.     }
  7. }
Warning
We recommend that you ensure the token is valid AND that the trackerName matches the serial number of the issuing SafeQod (formerly Ubiqod Key).
If the token does not exist, the response will be (code 200):
  1. {
  2.     "message": "Token not found for this account"
  3. }
Warning
For performance and security reasons, the token is kept for 24 hours after its issuance: remember to perform this validation upon receiving the data.

In case of an invalid API key, a 401 error will be returned.

If the token is not provided, a 400 error will be returned.