wubuwei/php-apple-signin

A simple library to decode and parse Apple Sign In client tokens.

2.0.1 2020-04-24 10:09 UTC

This package is auto-updated.

Last update: 2024-04-24 19:36:39 UTC


README

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

PHP 扩展包验证苹果授权登录后的参数 identifier tokens,确保 token 是真实的 Apple Id 授权的。

Installation

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

composer require wubuwei/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);

?>