蘋果登錄會驗證用戶: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,下載下來坑了我一下午才改好。