Welcome to the documentation for ArtisanPack UI Apple OAuth — the shared Sign in with Apple broker that powers every ArtisanPack UI Apple service integration.
Downstream packages (starting with calendar sync for artisanpack-ui/bookings) sit on top of this package — they resolve a valid access token from the shared TokenProvider seam and make their Apple API calls, without ever touching the OAuth handshake, client-secret JWT signer, or refresh flow themselves.
Use the navigation below to explore topics. Links use the GitLab wiki page style, so you can jump between pages like Getting Started or OAuth Flow.
- Getting Started
- Installation
- Credential Drivers
- OAuth Flow
- Broker Mode
- Stateless Client
- Scopes
- Tokens
- Client-Secret JWT
- Connection Model
- API Reference
- Testing
- FAQ
- Contributing
If you're new here, start with Getting Started.
What this package does
artisanpack-ui/apple-oauth owns the shared plumbing that every ArtisanPack UI Sign in with Apple integration builds on. It provides:
- OAuth2 authorization-code flow — builds the consent URL, verifies the returned
state/nonce/id_tokenclaims, exchanges the authorization code for tokens, and captures the one-shotuserpayload Apple only releases on first authorization. - ES256
client_secretJWT signing — Apple requires the OAuthclient_secretto be a short-lived JWT signed with the developer's P-256.p8key. The package mints, caches, and rotates one on demand. See Client-Secret JWT. - Encrypted token storage on a per-user
apple_connectionsmodel, with transparent refresh via the token manager and automatic disconnection oninvalid_grant. - A scope registry that lets any installed service package contribute scopes through the
ap.apple-oauth.scopesfilter hook. - Broker mode (since 1.1.0). Connect, callback, and refresh can run through an ArtisanPack UI OAuth broker, so a site holds no Apple client secret or
.p8key. See Broker Mode. - Stateless relay primitives (since 1.1.0). The
AppleClientruns the Apple leg from runtime credentials without touching the session or the database, which is what an OAuth broker is built on. - Credential storage drivers (config, database, or CMS) so credentials can live wherever a project already stores its secrets.
What this package does not do
- It does not call Apple APIs. That is the responsibility of downstream service packages (calendar sync, mail, …).
- It does not ship any web routes. Because Apple requires
response_mode=form_postfor scopes that release the one-shotuserpayload, the callback needs to be aPOSTyour app owns — see OAuth → Callback for the wiring. - It does not ship a Livewire / React / Vue connection-management UI. Apple's flow is simpler than Google's (no incremental consent, no per-service scope UX), so per-account connect / disconnect is a two-route affair in your app.
- It does not perform remote token revocation on disconnect — the flow marks the local connection disconnected. If you need to revoke with Apple, POST to
https://appleid.apple.com/auth/revokefrom your own code with the full form body Apple requires:client_id(your Services ID),client_secret(a client-secret JWT — either pre-minted, orAppleOAuth::clientSecret()->generate()),token(the stored refresh token or access token), andtoken_type_hint=refresh_token(oraccess_token, matching what you pass intoken). See OAuth → Disconnect for a full example.

