Reputation: 1
$username = 'MerchantXYZ';
$password = 'B81dff9bb4020a89e8ac44cdfdcecd702151182fdc952272661d290ab2e5849e31bb03deede';
$curl = curl_init();
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_URL, "https://api.neteller.com/v1/oauth2/token?grant_type=client_credentials");
curl_setopt($curl, CURLOPT_USERPWD, "$username:$password");
curl_setopt($curl, CURLOPT_HTTPHEADER, array("Content-Type:application/json", "Cache-Control:no-cache"));
curl_setopt($curl, CURLOPT_POSTFIELDS, array("scope"=>"default"));
curl_setopt($curl, CURLOPT_FOLLOWLOCATION, true);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
$serverOutput = curl_exec($curl);
echo $serverOutput;
I am using this code but every time show me { "error": "invalid_client" }
this message. I have checked my API and IP address, everything is perfect.
Upvotes: 0
Views: 1820
Reputation: 209
There are 4 reasons why you may get { "error": "invalid_client" }
when trying to get a token.
Check points 1) - 3); From your example I can see you can rule out point 4) as a possible reason.
Also, you don't need this line:
curl_setopt($curl, CURLOPT_POSTFIELDS, array("scope"=>"default"));
According to the documentation you shouldn't post anything in the body of the request when getting a token. Where did you get this example from?
Upvotes: 3