Sign In with Apple REST API 403 Forbidden

Hello, I would send POST data to the Sign In with Apple REST API, but corrently I got the error 403 Forbidden on my server. If i test it with curl in the terminal, it works.


Here is the php code for this:


$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://appleid.apple.com/auth/token');
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($myArray));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);

$serverOutput = curl_exec($ch);

if(curl_exec($ch) === false)
{
    echo 'Curl error: ' . curl_error($ch);
}
curl_close ($ch);
print_r($serverOutput);


I got http code 403 by apple server. What is wrong?

Accepted Reply

Ok solution was this:

curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6');

Replies

Ok solution was this:

curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.2) AppleWebKit/536.6 (KHTML, like Gecko) Chrome/20.0.1090.0 Safari/536.6');
please Hanashi, could you tell me why that caused a problem.

and if you please could you send me a sample of your integration with apple sign in service

regards.

https://api.authlete.com/api/service/get/21653835348762%C2%A0Authorization=Basic ZmFpemFuQG9ucWFuZXQuY29tOklsb3ZlbXlpbmRpYTFA

response { "resultCode": "A002201", "resultMessage": "[A002201] /service/get/{apiKey}, No service owner has the API credentials." } please help how fetch access token

https://onqanet.co.in/devra01/blocktrainV2/redirect.php after login return Authorization server returned an invalid state parameter