Token Validation failed - Code 9210

JavierIbarraQPC
Occasional Visitor

Token Validation failed - Code 9210

Dear team,

 

We are having issues with the visa sandbox; I am attaching the request that we are sending to VDP: 


Accept: application/json,application/octet-stream

Accept-Encoding: gzip

Accept-Language: ru

Authorization: Basic RVI4ODExU0ZWMkswSTkxRjhYWDkyMXVPUzZqZnhETmZ6VDk0RzFnVVBUUHdVOTRpYzplaHN3V001VEhmNlBjcThRZTV6ajFlMjE=

Cache-Control: no-cache

Connection: keep-alive

Content-Length: 1433

Content-Type: application/json

Host: sandbox.api.visa.com

keyId: 54035cf2-ebd4-472b-8189-5113252a9283



{"encData":"eyJhbGciOiJSU0EtT0FFUC0yNTYiLCJlbmMiOiJBMTI4R0NNIiwiaWF0IjoxNzI5NzY1MDMxMDE1LCJraWQiOiI1NDAzNWNmMi1lYmQ0LTQ3MmItODE4OS01MTEzMjUyYTkyODMiLCJ0eXAiOiJKT1NFIn0.B7GUTt9w9fQtpwoAuhL-nbFPqwh7ocNYyTv1q7Rqf4IqDkOmd_2VQaceLiWmEjB1DGUTQAQdTirVIMtoYHGCP6It9aE6EIUfRAoGEEAPQiwxIVEu7eEaAYSuvqomAElZp8s8UqIHYvxH3phCkpQ0t9cJxg-EgIL_N36yR58mhQLC_-eUOweF3S7s8lujks8Sgulh-aGr8Vcm56dWKgO1eBc4XUzcKmpmuq9bB_gv8qTtGmJreuh4VM7ZoSkI-CMCxDlTfxnIr4405so7Ap5JDlWcoYToNQSDjOstMnstGq6Ae_qouA5RqTkvyHRIzR10j0aEicgcoBDtnegKXwuhUw.g8VUCPVaUhsu0RpD.6dIee4maBevtOWrMY5DK5g3QiZ8lGL99xJzXnZnxY1IB0yTZIdzreIcWriV_XijYrhktW6j5W4coINNMFZfoDNrDx94kpQaACbz2SphhZukXPTF-9fJu12_SePcv4xgJpuoK0nPj3x5iAkjEpf7bH8w6BgRuiJHJZoKkWvuXJB6sr6HPzUkSzdN9J2YPxWwmi6SRK8HHoy6sNbuvEkbxqaBQWCBEA8jjCoO7JssFNBWdVC8fFjm3KOUm15b-o3FZ0T8o8eqI9yuGsHNF3UasjPGFZeSba9GUgc3-ee4dTIjTtpyMKzlE0-MGy3P2XKtVOXNfnUcCgK7JIQ_LRqEB8wN6aHNoitL0uDfbF4WzNwzlzV6TYgpq7amuNjPLt-A5ajmPuygU5v42ocDVDcbrTzYA-Wf76xCMrx-emGhKn7L8ZD1CeIR-wjTWGr-QC61u7_7LcjzTHQSHIKjaCMgaAw2-tzDLTcP1Z4VhlLtvx4vSpwpoScfAOAb8d5CnO0TOltkZYsYFBzHVM5yWsNOPeXgsLbbLUWnDLrv2aVTsGeRIpq8h7J43sHJ_m8mzmXm4jaj23x7wXWPnGm2LIoIhMUboZsUCrlADqrRn8yPz5NHfSuMhzxja51KD3OkcTHu_0Du_DDwIjBdkxYwMKijMtYuGQSF2u3MFuFfhZn_ZVapVMpnsC_3imBdTzrkcTLeQIGtZE85lWxZ1YV3B0AV2ZbrWOe8iGms0j72GH5X0GRhYrqlzbRO7NTnJh1kE8h7FZcSPP9Dv0dOdcYqdpf3XEIQTobF9-VZElzPW_rhmPUjieosVvgxz_BJrPfLvifkuYv60F6dyLYYoBq9lii7CPGHlL-bU8pJcvz4_C_yvgyg1cFUi.E34-YDBSf1lZAYwFQKggyQ"}


------------------------------------------------------------------------------------------------------------------------------------------------------
RESPONSE:


HTTP/1.1 401

Cache-Control: no-cache, no-store, must-revalidate

Connection: keep-alive

Content-Length: 112

Content-Security-Policy-Report-Only: default-src 'self' https://*.v.me https://*.visa.com;script-src 'self' 'unsafe-inline' 'unsafe-eval'  https://*.visa.com https://*.v.me;img-src 'self' https://*.v.me https://*.visa.com https://*.unica.com https://ad.doubleclick.net;style-src 'self' 'unsafe-inline' https://*.visa.com;object-src  https://*.v.me https://*.visa.com data:;report-uri /logging/logCSPReport;

Content-Type: application/json;charset=UTF-8

Date: Thu, 24 Oct 2024 09:17:09 GMT

Expires: -1

Pragma: no-cache

Server: nginx

Strict-Transport-Security: max-age=31536000;includeSubdomains

X-APP-STATUS: 401

X-Content-Security-Policy-Report-Only: default-src 'self' https://*.v.me https://*.visa.com;script-src 'self' 'unsafe-inline' 'unsafe-eval'  https://*.visa.com https://*.v.me;img-src 'self' https://*.v.me https://*.visa.com https://*.unica.com https://ad.doubleclick.net;style-src 'self' 'unsafe-inline' https://*.visa.com;object-src  https://*.v.me https://*.visa.com data:;report-uri /logging/logCSPReport;

X-Content-Type-Options: nosniff

X-CORRELATION-ID: 1729761429_521_493796426_-7c479c7889t_VDP_WS

X-ERROR-ORIGIN: 9200

X-Frame-Options: SAMEORIGIN

X-SERVED-BY: -7c479c7889t

X-WebKit-CSP-Report-Only: default-src 'self' https://*.v.me https://*.visa.com;script-src 'self' 'unsafe-inline' 'unsafe-eval'  https://*.visa.com https://*.v.me;img-src 'self' https://*.v.me https://*.visa.com https://*.unica.com https://ad.doubleclick.net;style-src 'self' 'unsafe-inline' https://*.visa.com;object-src  https://*.v.me https://*.visa.com data:;report-uri /logging/logCSPReport;

X-XSS-Protection: 0



{"responseStatus":{"status":401,"code":"9210","severity":"ERROR","message":"Token validation failed","info":""}}
 
Could you please advice what is the message error details here?
Thanks,
Javier
3 REPLIES 3
SyedSa
Community Moderator

Re: Token Validation failed - Code 9210

Hi @JavierIbarraQPC, Thank you for reaching out. An agent will look into this and get back to you soon. Until then, if any community member knows a solution, feel free to reply in this thread. 

JavierIbarraQPC
Occasional Visitor

Re: Token Validation failed - Code 9210

Hi

Is there any update?
DianaVisaPM
Visa Developer Support Specialist

Re: Token Validation failed - Code 9210

Hey @JavierIbarraQPC,

 

The error message "Token validation failed - Code 9210" indicates that the token provided in your request was not validated successfully by the Visa Developer Platform (VDP). This typically means there is an issue with how the token is being generated, formatted, or included in the request.

 

Here are some common reasons and troubleshooting steps for this issue:

1. Authorization Header:
Ensure that the `Authorization` header is correctly set. It should use the correct credentials (API key and secret) encoded in Base64 format. Verify that the credentials are correct and properly encoded.

2. Key ID (keyId):
The `keyId` specified in the request headers should match the one registered in your Visa Developer Portal project. Double-check that the `keyId` is accurate.

3. Token Generation:
The `encData` field in your JSON payload contains the encrypted data. Ensure that you are using the correct encryption method and keys. The token must be generated using the private key that corresponds to the public key you uploaded to the Visa Developer Portal.

4. Certificate and Keys:
Verify that your certificates and keys are correctly configured and not expired. Ensure that the public key registered with Visa matches the private key used to sign the request.

5. Timestamp:
Check the timestamp included in the token payload. Tokens may be time-sensitive, and if the timestamp is not within an acceptable range, the token could be rejected.

6. Environment:
Make sure you are using the correct endpoint for the sandbox environment. Any mismatch between the environment (sandbox vs. production) and the credentials can cause validation errors.

 

Here is an example of how to properly set up the request in code to ensure token validation:

```python
# START 
import requests
from base64 import b64encode

# Replace these with your actual credentials and keys
api_key = 'your_api_key'
api_secret = 'your_api_secret'
encoded_credentials = b64encode(f"{api_key}:{api_secret}".encode()).decode()

headers = {
'Accept': 'application/json,application/octet-stream',
'Accept-Encoding': 'gzip',
'Accept-Language': 'en',
'Authorization': f'Basic {encoded_credentials}',
'Cache-Control': 'no-cache',
'Connection': 'keep-alive',
'Content-Type': 'application/json',
'Host': 'sandbox.api.visa.com',
'keyId': 'your_key_id'
}

data = {
"encData": "your_encrypted_data_here"
}

response = requests.post('https://sandbox.api.visa.com/aliasdirectory/v1/aliases', headers=headers, json=data)

print(response.status_code)
print(response.json())
# END 
```

 

Make sure to replace the placeholders with your actual credentials and encrypted data.




Thanks,

Diana



Was your question answered? Don't forget to click on "Accept as Solution" to help other devs find the answer to the same question.