1. Go to this page and download the library: Download artisanpack-ui/apple-oauth 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/ */
use ArtisanPackUI\Hooks\Facades\Filter;
// Reserved for when Apple issues new scopes. Do NOT register a made-up scope
// against production Apple today — Apple will reject the whole authorization.
Filter::add( 'ap.apple-oauth.scopes', function ( array $scopes ): array {
// $scopes[] = '<future-apple-scope>';
return $scopes;
} );
use ArtisanPackUI\AppleOAuth\Facades\AppleOAuth;
$connection = $user->appleConnection; // however you load it
$response = AppleOAuth::manager()
->request( $connection )
->acceptJson()
->get( 'https://caldav.icloud.com/...' );
use ArtisanPackUI\AppleOAuth\Contracts\TokenProvider;
use ArtisanPackUI\AppleOAuth\Models\AppleConnection;
public function __construct( protected TokenProvider $apple ) {}
public function fetch( AppleConnection $connection ): array
{
$token = $this->apple->accessTokenFor( $connection );
// ...
}