PHP code example of luoyy / apple-auth-verify

1. Go to this page and download the library: Download luoyy/apple-auth-verify library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

luoyy / apple-auth-verify example snippets


/**
 * DEMO
 */
use luoyy\AppleAuthVerify\Exceptions\TokenException;
use luoyy\AppleAuthVerify\Token;

try {
    if (($identity = Token::verify($request->get('identityToken'))) === false) {
        throw new AuthException('identityToken verification failed.', 400);
    }
} catch (TokenException $e) {
    throw new AuthException('identityToken Parsing failed.', 400);
}

if (time() > $identity->exp) {
    throw new AuthException('identityToken Expired, please re-authorize.', 400);
}