Level 2
I have done that, but it does not work... It return a 400 "invalid client" :
$teamId = config('services.apple.team_id');
$keyId = config('services.apple.key_id');
$sub = config('services.apple.client_id');
$aud = 'https://appleid.apple.com';
$iat = strtotime('now');
$exp = strtotime('+60days');
$keyContent = file_get_contents(storage_path(config('services.apple.private_key')));
$client_secret = JWT::encode([
'iss' => $teamId,
'iat' => $iat,
'exp' => $exp,
'aud' => $aud,
'sub' => $sub,
], $keyContent, 'ES256', $keyId);
config()->set('services.apple.client_secret', $client_secret);
$client = new Client();
$response = $client->request('POST', 'https://appleid.apple.com/auth/token', [
'grant_type' => 'authorization_code',
//'redirect_uri' => config('services.apple.redirect'),
'client_id' => config('services.apple.client_id'),
'client_secret' => $client_secret,
'code' => $request->authorizationCode,
]);
dd($response->getBody());