Authentication and Permissions
Sign In with Apple
Instant supports Sign In with Apple on the Web and in native applications.
#Step 1: Create App ID
- Navigate to Certificates, Identifiers & Profiles
- Select Identifiers
- Click +
- Register a new identifier → Select App IDs
- Select a type → Select App
- Capabilities → Sign In with Apple → Check
- Fill in Bundle ID and Description
- Click Register
#Step 2: Create Services ID
- Navigate to Services IDs
- Click +
- Register a new identifier → Select Services IDs
- Fill in Description and Identifier. You’ll need this Identifier later
- Click Register
#Step 3: Configure Services ID (Web Redirect flow)
- Select newly created Services ID
- Enable Sign In with Apple
- Click Configure
- Select Primary App ID from Step 1
- To Domains, add
api.instantdb.com - To Return URLs, add
https://api.instantdb.com/runtime/oauth/callback - Click Continue → Save
#Step 3.5: Generate Private Key (Web Redirect flow only)
- Navigate to Keys
- Click +
- Fill in Name and Description
- Check Sign in with Apple
- Configure → select App ID from Step 1
- Continue → Register
- Download key file
#Step 4: Register your OAuth client with Instant
From the dashboard
From the Auth tab on the Instant dashboard:
- Click "Add Apple Client"
- Select a unique client name (
appleby default, used indb.authcalls) - Fill in your "Services ID" from Step 2
- Fill in your "Team ID" from Membership details
- Fill in your "Key ID" from Step 3.5
- Fill in your "Private Key" by copying the file content from Step 3.5
- Click "Add Apple Client"
From the terminal
npx instant-cli@latest auth client add \--type apple --name apple \--services-id <services-id> \--team-id <team-id> --key-id <key-id> \--private-key-file <path-to-key.p8>
#Step 4.5: Whitelist your domain in Instant (Web Redirect flow only)
From the dashboard
From the Auth tab on the Instant dashboard:
- Click "Redirect Origins" → "Add an origin"
- Add your app's domain (e.g.
myapp.com)
From the terminal
npx instant-cli@latest auth origin add --type website --url myapp.com
#Step 5: Add Sign In code to your app (Web Popup flow)
Create Sign In link using clientName from Step 4:
const authUrl = db.auth.createAuthorizationURL({clientName: '<clientName>',redirectURL: window.location.href,});
Add a link uses authUrl:
<a href={ authUrl }>Sign In with Apple</a>
That’s it!