Stratkit Apple Sign-In¶
Native Apple Sign-In wrapper for Unity (iOS only). Provides an async API to authenticate users via Sign in with Apple and retrieve an identity token for backend verification.
Supported Platforms¶
| Platform | SDK | Min Version |
|---|---|---|
| iOS | AuthenticationServices (built-in) | iOS 13.0+ |
| Editor | Mock provider (returns test token) | - |
Android and other unsupported platforms use the Editor mock provider with a warning log.
Setup¶
1. Apple Developer Portal¶
Enable "Sign in with Apple" capability in your App ID configuration at Apple Developer.
No client IDs or secrets are needed on the client side — Apple uses the app's bundle identifier automatically.
2. Configuration Asset¶
Create an AppleSignInConfiguration ScriptableObject:
Right-click in Project > Create > Stratkit > Apple Sign-In > AppleSignInConfiguration
Options:
- RequestEmail — request the user's email address (default: true)
- RequestFullName — request the user's full name (default: true)
Note: Apple only returns email and full name on the first sign-in. The backend must persist these values.
3. Initialize at Startup¶
Call Configure() once during bootstrap, before any sign-in attempt:
4. Sign In¶
try {
AppleSignInResult result = await AppleSignInService.SignInAsync();
string idToken = result.IdToken;
// Send idToken to your backend for verification
} catch (AppleSignInException e) {
// Handle error (e.ErrorCode for specific failure reason)
}
Build Post-Processing¶
The AppleSignInBuildProcessor automatically handles iOS builds:
- Adds
AuthenticationServices.frameworkto the Xcode project - Adds "Sign in with Apple" capability via
ProjectCapabilityManager - Creates the entitlements file with
com.apple.developer.applesignin
API Reference¶
| Type | Description |
|---|---|
AppleSignInService |
Static entry point — Configure() and SignInAsync() |
AppleSignInResult |
Result containing IdToken, AuthorizationCode, UserId, Email, FullName, Nonce |
AppleSignInConfiguration |
ScriptableObject with scope options (email, full name) |
AppleSignInException |
Exception with ErrorCode (Cancelled, Failed, InvalidResponse, etc.) |