Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Apple Laravel Package

socialiteproviders/apple

Apple provider for Laravel Socialite, enabling Sign in with Apple via a native OAuth provider. Install with Composer, configure your Apple client ID, team ID, key ID, and private key, then authenticate users with a single Socialite call. Maintained by the Socialite Providers community.

View on GitHub
Deep Wiki
Context7

A Laravel Socialite provider that adds Sign in with Apple support to your application. It integrates cleanly with SocialiteProviders and handles Apple’s OAuth flow so you can authenticate users with their Apple ID.

  • Enables Socialite::driver('apple') authentication
  • Supports Apple’s id_token and user profile retrieval
  • Configurable client ID, team ID, key ID, and private key
  • Works with existing Laravel Socialite workflows
  • Lightweight setup via Composer and service provider registration
Frequently asked questions about Apple
How do I install socialiteproviders/apple in my Laravel app?
Run composer require socialiteproviders/apple, then register the SocialiteProviders\Manager\SocialiteWasCalled event listener that calls extend with the Apple provider. Add an apple block to config/services.php containing client_id, client_secret, and redirect. Clear your config cache after changing credentials. Package discovery handles the service provider, so no manual registration is normally needed.
What values go in config/services.php for the Apple provider?
client_id is your Apple Service ID, client_secret is the ES256-signed JWT, and redirect must exactly match the Return URL registered with Apple. Apple requires the redirect URL to use HTTPS. Store the values in .env and reference them from config/services.php. The client_secret is not a static password, so do not paste a raw Apple private key there.
How do I generate the client secret JWT for Sign in with Apple?
Create a JWT with header alg ES256 and kid set to your Apple Key ID, and claims iss set to your Team ID, sub set to the Service ID, aud set to https://appleid.apple.com, plus iat and exp. Sign it with the .p8 private key downloaded from the Apple Developer portal. Libraries such as firebase/php-jwt or lcobucci/jwt can build it. Apple limits exp to six months, so generate and rotate the secret before it expires.
Does socialiteproviders/apple support Laravel 11?
Current releases track Socialite 5.x and work with Laravel 11, while older Laravel versions are served by earlier tags. The exact version constraints are listed in the package composer.json on Packagist. Pin the package version that matches your Laravel and Socialite versions, then run composer update. Check the repository release notes if you are upgrading a legacy app.
Why does Sign in with Apple fail on localhost?
Apple only accepts HTTPS Return URLs registered on your Service ID, so plain http://localhost callbacks are rejected. Use a tunnel such as ngrok or Expose to obtain an HTTPS URL, and register that URL in the Apple Developer console. Update config/services.php and Apple's Return URL whenever the tunnel domain changes. Local testing usually works best against a staging domain you control.
How do I get the user's name and email from Apple?
Apple includes name and email claims in the id_token, but the name is provided only during the first authorization. Subsequent logins may return only the subject identifier, and the email may be a private relay address ending in privaterelay.appleid.com. Persist the name and email on first login and handle future logins where they are absent. Request the name and email scopes if your app needs them.
Why is my Apple callback route returning 419 or 405 errors?
Apple posts the authorization response to your redirect URI using form_post, so the callback route must accept POST. Define Route::post for the callback path and exclude that URI from CSRF verification in your middleware configuration. A GET-only route explains the 405, and a missing CSRF exclusion explains the 419. Verify the route path matches the Return URL registered with Apple.
How can I test Apple login without calling Apple's servers?
Mock the Socialite driver with Socialite::shouldReceive('driver')->with('apple') and return a fake user, or use Http::fake for the token exchange. Feature tests can POST a code parameter directly to your callback route. Assert that your app creates or logs in the user and redirects correctly. Keep real Apple credentials and private keys out of the test suite.
Does Apple return refresh tokens and how do I handle token refresh?
Apple's token endpoint returns access_token, refresh_token, id_token, and expires_in. To refresh, send the refresh_token with a newly generated client secret JWT to Apple's token endpoint. Store refresh tokens securely if you need offline access. Because the client secret itself expires, generate it dynamically or schedule rotation before the six-month limit.
What are alternatives to socialiteproviders/apple?
You can write a custom Socialite provider, use Apple's Sign in with Apple JS in the browser and verify the id_token server-side, or choose another community package. socialiteproviders/apple is popular because it plugs into Socialite's existing driver and user flow. Compare maintenance activity and Laravel version support before selecting an alternative.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
robertmarney/lara-hierarchial-collections
simonschaufi/rule-doc-generator
emissaoja/emissaoja
blackbricksoftware/gravityforms-civicrm-form-processor
al-rahabi/fancy-crud
jinas/dhivatar-component
mltstephane/laravel-quality
bernskiold/laravel-talentlms
bernskioldmedia/laravel-form-architect
youbar/easy-crud
c-point-labs/laravel-hostyourai
dbravoan/dbcms-admin-theme-dbcms
dbravoan/dbcms-theme-db-cyber
dbravoan/dbcms-blocks-basic
dbravoan/dbcms-module-content-audit
dbravoan/dbcms-module-ai-assistant
paygate-to/paygate-php
padosoft/askmydocs-connector-base
defstudio/supercharged-carbon
bernskioldmedia/laravel-matomo