killov / apple-sign-in
Apple ID - web sign in
Installs: 33 595
Dependents: 0
Suggesters: 0
Security: 0
Stars: 2
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/killov/apple-sign-in
Requires
- php: >= 7.2
- ext-json: *
- guzzlehttp/guzzle: ^6.0|^7.0
This package is auto-updated.
Last update: 2025-12-27 20:55:55 UTC
README
Library for web sign in over Apple ID.
Installation
For install please use composer.
composer require killov/apple-sign-in
Basic usage
Common code
$signIn = AppleSignInBuilder::create() ->setClientId("client") ->setTeamId("BDT54D54G5") ->setKeyPath("DG755G24FK", __DIR__ . "\keys\key.p8") ->setRedirectUrl($publicPath . "sign/apple-return") ->build();
Generate link for link button
$state = "random_code"; $_SESSION["state"] = $state; // store to session for for distraction CSRF $link = $signIn->createAuthUrl($state); // https://appleid.apple.com/auth/authorize?response_type=code...
Prepare a return endpoint (redirectUrl)
$state = $_POST["state"]; // validate state from session if ($_SESSION["state"] !== $state) { return; } $code = $_POST["code"]; // fetch JWT token $jwt = $signIn->fetchAccessTokenWithAuthCode($code)->getIdTokenString()
Decode JWT token or use Sign-in with Apple SDK.