'Opayo merchant session key. Authentication values are missing
We are getting the following error when executing this:
[description] => Authentication values are missing [code] => 1001
Can anyone see what I am doing wrong. I tried removing the base64_encode function but this didn't have any impact.
I got the integration key and password from opayo (sagepay) - the test environment.
My php code follows:
$key = base64_encode("My Integration Key");
$password = "My Integration Password";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => "https://pi-test.sagepay.com/api/v1/merchant-session-keys",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_SSL_VERIFYPEER => false,
CURLOPT_SSL_VERIFYHOST => false,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => '{ "vendorName": "MY VENDOR" }',
CURLOPT_HTTPHEADER => array(
"Authorization: Basic $key:$password",
"Cache-Control: no-cache",
"Content-Type: application/json"
)
));
$response = curl_exec($curl);
$response = json_decode($response, true);
$err = curl_error($curl);
curl_close($curl);
Tia for any help
Solution 1:[1]
Both the key and password had to be base 64 encoded.
ie $key = base64_encode("My Integration Key:My Integration Password"); and then fed in to the curl http header as
"Authorization: Basic $key",
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | jagku |
