0
点赞
收藏
分享

微信扫一扫

苹果登录php验证


苹果登录使用的jwt 验证的方式

通过获取​​https://appleid.apple.com/auth/keys​​ 获取公钥

具体的实现规则有更详细的介绍:​​点击查看​​

PHP library to manage Sign In with Apple identifier tokens, and validate them server side passed through by the iOS client.

Installation

Use composer to manage your dependencies and download php-apple-signin:

composer require griffinledingham/php-apple-signin

Example

<?php
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);

?>


举报

相关推荐

0 条评论