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
- Go to the Instant dashboard and select Auth tab.
- Select Add Apple Client
- Select unique clientName (
appleby default, will be used indb.authcalls) - Fill in Services ID from Step 2
- Fill in Team ID from Membership details
- Fill in Key ID from Step 3.5
- Fill in Private Key by copying file content from Step 3.5
- Click
Add Apple Client
#Step 4.5: Whitelist your domain in Instant (Web Redirect flow only)
- In Instant Dashboard, Click Redirect Origins → Add an origin
- Add your app’s domain (e.g.
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!