客戶端進行蘋果登錄登錄授權,然後需要在服務端進行身份有效認證校驗場景。
以下說明參考了這裏,具體詳情可以查閱該github:https://github.com/GriffinLedingham/php-apple-signin
1、安裝第三方包
composer require griffinledingham/php-apple-signin
2、代碼示例
use AppleSignIn\ASDecoder;
$clientUser = "example_client_user";
$identityToken = "example_encoded_jwt";
$appleSignInPayload = ASDecoder::getAppleSignInPayload($identityToken);
/**
* Obtain the Sign In with Apple email and user creds.
*/
$email = $appleSignInPayload->getEmail();
$user = $appleSignInPayload->getUser();
/**
* Determine whether the client-provided user is valid.
*/
$isValid = $appleSignInPayload->verifyUser($clientUser);