Whenever I try to authenticate with Two Way SSL, I keep getting Error 401 code 9124.
I verified that the user_id and password are correct and am stumped as to what I am doing wrong. Any advice would be greatly appreciated.
[fedora@temp visa]$ python3 hello_world.py
< GET /vdp/helloworld HTTP/1.1
< Host: sandbox.api.visa.com
< User-Agent: python-requests/2.19.1
< Accept-Encoding: gzip, deflate
< Accept: application/json
< Connection: keep-alive
< Content-Type: application/json
< Authorization: Basic NDhHVU8wV1dPVTRNRVBWWElJSDUyMTFvYTdVOFFtOTNMQlRxODk5N0JkUVY2ZVZZNDo3MUpuVWhLdjN6V0FMT2o=
<
> HTTP/1.1 401 Unauthorized
> Server: nginx
> Content-Type: application/json;charset=UTF-8
> Content-Length: 119
> X-SERVED-BY: l73c018
> X-CORRELATION-ID: 1560548141_524_207894318_l73c018_VDP_WS
> x-vdp-normalized-url: /vdp/helloworld
> X-APP-STATUS: 401
> x-vdp-authn-api-visa-id: HELLOWORLD
> X-Frame-Options: SAMEORIGIN
> X-XSS-Protection: 1; mode=block
> X-Content-Type-Options: nosniff
> Strict-Transport-Security: max-age=2592000;includeSubdomains
> Cache-Control: no-cache, no-store, must-revalidate
> Pragma: no-cache
> Expires: -1
> Date: Fri, 14 Jun 2019 21:35:41 GMT
> Connection: keep-alive
>
{"responseStatus":{"status":401,"code":"9124","severity":"ERROR","message":"Incorrect credentials supplied","info":""}}
{'responseStatus': {'status': 401, 'code': '9124', 'severity': 'ERROR', 'message': 'Incorrect credentials supplied', 'info': ''}}
Hello World Endpoint
#!/usr/bin/python3
import requests
from requests_toolbelt.utils import dump
def main():
URL = "<a href="https://sandbox.api.visa.com/vdp/helloworld" target="_blank">https://sandbox.api.visa.com/vdp/helloworld</a>"
CA_CERT = "/home/fedora/visa/DigiCertGlobalRootCA.pem"
CLIENT_CERT = "/home/fedora/visa/client_cert_d2288d04-5699-47ff-8d89-54cf04ec4fca.pem"
PRIVATE_KEY = "/home/fedora/visa/key_d2288d04-5699-47ff-8d89-54cf04ec4fca.pem"
USER_ID = '48GUO0WWOU4MEPVXIIH5211oa7U8Qm93LBTq8997BdQV6eVY4'
PASS = '71JnUhKv3zWALOj'
HEADERS = {'Accept': 'application/json', 'Content-Type': 'application/json'}
r = requests.get(URL,
verify = (CA_CERT),
cert = (CLIENT_CERT, PRIVATE_KEY),
headers = HEADERS,
auth = (USER_ID, PASS))
data = dump.dump_all(r)
print(data.decode('utf-8'))
print(r.json())
if __name__ == "__main__":
main()
I get the exact same error when I try calling the Payment Processing Authorization endpoint.
#!/usr/bin/python3
import requests
from requests_toolbelt.utils import dump
def main():
URL = "<a href="https://sandbox.api.visa.com/acs/v1/payments/authorizations" target="_blank">https://sandbox.api.visa.com/acs/v1/payments/authorizations</a>"
CA_CERT = "/home/fedora/visa/DigiCertGlobalRootCA.pem"
CLIENT_CERT = "/home/fedora/visa/client_cert_d2288d04-5699-47ff-8d89-54cf04ec4fca.pem"
PRIVATE_KEY = "/home/fedora/visa/key_d2288d04-5699-47ff-8d89-54cf04ec4fca.pem"
USER_ID = "48GUO0WWOU4MEPVXIIH5211oa7U8Qm93LBTq8997BdQV6eVY4"
PASS = "71JnUhKv3zWALOj"
HEADERS = {'Accept': 'application/json', 'Content-Type': 'application/json'}
BODY = {
"acctInfo": {
"primryAcctNum": {
"pan": "4111111111111111",
"panExpDt": "2019-12"
}
},
"cardAcceptr": {
"clientId": "0123456789012345678901234567893"
},
"freeFormDescrptnData": "Freeformdata",
"msgIdentfctn": {
"correlatnId": "14bc567d90f23e56a8f045",
"origId": "123451234567890"
},
"msgTransprtData": "TransportData",
"transctn": {
"eComData": {
"digitalGoods": "true",
"eciCd": "5",
"xid": "EEC4567F90123A5678B0123EA67890D2345678FF"
},
"localDtTm": "2019-06-14T18:11:07",
"partialAuthInd": "true",
"posData": {
"envrnmnt": "eCom",
"panEntryMode": "OnFile",
"panSrce": "VCIND"
},
"tranAmt": {
"amt": "123.45",
"numCurrCd": "840"
},
"tranDesc": "Transactiondescription"
},
"verfctnData": {
"billngAddr": {
"addrLn": "PO Box 12345",
"postlCd": "12345"
}
},
"riskAssessmntData": {
"lowVlExmptn": "true",
"traExmptn": "true",
"trustdMerchntExmptn": "true",
"scpExmptn": "true",
"delgtdAthntctn": "true"
}
}
r = requests.post(URL,
verify = (CA_CERT),
cert = (CLIENT_CERT, PRIVATE_KEY),
headers = HEADERS,
auth = (USER_ID, PASS),
data = BODY)
data = dump.dump_all(r)
print(data.decode('utf-8'))
if __name__ == "__main__":
main()
Solved! Go to Solution
Hello @HauptJ,
To further investigate, please provide the following information:
1. End Point
2. Request Header
3. Request Body
4. Response Header (include the x-correlation-id)
5. Response Body
Using SoapUI, you can find the x-correlation-id in the Raw Tab of the response header.
Also, when you create a test App in our sandbox you will receive test data in your App. The test data for your Visa Developer application is available in the Dashboard under test data in the left navigation, this will ensure that you are using valid data that has been provisioned for specific scenarios. You will basically have a table per API that is split into the Request and Response sections and the values on the Request section are meant to be populated in the payload with the intention of obtaining results specified in the Response section.
Sandbox data is limited to what is provided in the Test Data tables and is not integrated to the Visa Network and you cannot test real data in sandbox.
End Point: https://sandbox.api.visa.com/vdp/helloworld
Request Header and Body:
GET <a href="https://sandbox.api.visa.com/vdp/helloworld" target="_blank">https://sandbox.api.visa.com/vdp/helloworld</a> HTTP/1.1
Accept-Encoding: gzip,deflate
Authorization: Basic NDhHVU8wV1dPVTRNRVBWWElJSDUyMTFvYTdVOFFtOTNMQlRxODk5N0JkUVY2ZVZZNDo3MUpuVWhLdjN6V0FMT2o=
Host: sandbox.api.visa.com
Connection: Keep-Alive
User-Agent: Apache-HttpClient/4.1.1 (java 1.5)
Response Header and Body:
HTTP/1.1 401 Unauthorized
Server: nginx
Content-Type: application/json;charset=UTF-8
Content-Length: 119
X-SERVED-BY: l55c013
X-CORRELATION-ID: 1560802397_133_378403308_l55c013_VDP_WS
x-vdp-normalized-url: /vdp/helloworld
X-APP-STATUS: 401
x-vdp-authn-api-visa-id: HELLOWORLD
X-Frame-Options: SAMEORIGIN
X-XSS-Protection: 1; mode=block
X-Content-Type-Options: nosniff
Strict-Transport-Security: max-age=2592000;includeSubdomains
Cache-Control: no-cache, no-store, must-revalidate
Pragma: no-cache
Expires: -1
Date: Mon, 17 Jun 2019 20:13:17 GMT
Connection: keep-alive
{"responseStatus":{"status":401,"code":"9124","severity":"ERROR","message":"Incorrect credentials supplied","info":""}}
I created the .p12 using:
openssl pkcs12 -export -in client_cert_d2288d04-5699-47ff-8d89-54cf04ec4fca.pem -inkey "key_d2288d04-5699-47ff-8d89-54cf04ec4fca.pem" -certfile cert.pem -out pp_test.p12
client_cert: Client Encryption Certificate
key_...: Private key
cert.pem: project certificate
Hi @HauptJ,
Thanks for letting us know how you resolved the issue! Have a nice day 🙂