When a user scans an Ubiqod Key, the Ubiqod platform ensures that this scan is legitimate.
There are 2 cases to distinguish:
- You are using an interface created on the Ubiqod platform: validation is performed automatically
- 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
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:
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 Ubiqod Key from the redirected URL parameters.
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>>)
Server response
In case of success, the server response will be in the form (code 200):
- {
- "tokenData": {
- "creationDate": "2021-02-04T15:10:32.157Z",
- "trackerLabel": "Test device",
- "trackerName": "UK12346"
- }
- }
We recommend that you ensure the token is valid AND that the trackerName matches the serial number of the issuing Ubiqod Key.
If the token does not exist, the response will be (code 200):
- {
- "message": "Token not found for this account"
- }
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.