苹果登录会验证用户:identityToken 的合法性,验证方法是JWT验证。
完整的验证identityToken的代码可参考:https://github.com/GriffinLedingham/php-apple-signin
use AppleSignIn\ASDecoder;
$identityToken = Request::instance()->param('identityToken'); $clientUser = Request::instance()->param('clientUser'); $appleSignInPayload = ASDecoder::getAppleSignInPayload($identityToken); $email = $appleSignInPayload->getEmail(); $user = $appleSignInPayload->getUser(); $isValid = $appleSignInPayload->verifyUser($clientUser);
代码很短,有问题发邮箱吧,提醒一下,上面git代码php版本最好使用7.2,如果使用其他版本请自己修改代码,本人环境就是7.0,下载下来坑了我一下午才改好。