Apple Sign In Setup Guide for Mobile App
This guide will help you set up Apple Sign In in your MartFury mobile app.
Prerequisites
- An Apple Developer Account ($99/year)
- Access to your app's bundle identifier in Apple Developer Portal
- Basic knowledge of mobile app development
iOS Only Feature
Apple Sign In is primarily for iOS. On Android, users can still sign in via web-based Apple authentication, but the native button is typically hidden.
Step 1: Configure Apple Developer Account
- Go to Apple Developer Portal
- Sign in with your Apple Developer account
- Go to Certificates, Identifiers & Profiles
- Select Identifiers → Select your app's identifier (or create one)
- Enable Sign In with Apple capability
- Click Save
Create a Services ID (for web/Android fallback)
- Go to Identifiers → Click + button
- Select Services IDs → Click Continue
- Enter a description and identifier (e.g.,
com.yourcompany.app.service) - Click Continue → Register
- Click on the newly created Services ID
- Enable Sign In with Apple checkbox
- Click Configure next to Sign In with Apple
- Add your website domain and return URLs
- Click Save
Step 2: Configure Your Mobile App
Environment Variables
Create or update your .env file with the following variables:
# Apple Sign-In credentials
APPLE_SERVICE_ID=com.yourcompany.app.service
APPLE_TEAM_ID=YOUR_TEAM_ID
# Enable Apple Sign-In
ENABLE_APPLE_SIGN_IN=true| Variable | Where to Find |
|---|---|
APPLE_SERVICE_ID | The Services ID you created (e.g., com.yourcompany.app.service) |
APPLE_TEAM_ID | Apple Developer Portal → Membership → Team ID |
iOS Configuration
For iOS, you need to add the Sign In with Apple capability in Xcode:
- Open
ios/Runner.xcworkspacein Xcode - Select the Runner target
- Go to Signing & Capabilities tab
- Click + Capability
- Add Sign In with Apple
::: note The sign_in_with_apple Flutter package handles URL scheme registration automatically. You don't need to manually add URL schemes for Apple Sign In. :::
Android Configuration
The sign_in_with_apple package works on Android via web-based authentication. No additional AndroidManifest configuration is required - the package handles this automatically.
Step 3: Testing the Integration
- Run your app on an iOS device or simulator
- Go to the login screen
- Tap the Apple Sign In button
- Complete the Apple authentication flow (Face ID/Touch ID)
- Verify that you're redirected back to your app
Testing Limitations
- Apple Sign In works best on real iOS devices
- Simulator testing may have limitations
- First-time users will see email options (share/hide email)
Troubleshooting
Common Issues
1. Apple Sign In button not showing
- Verify
ENABLE_APPLE_SIGN_IN=truein your.envfile - Ensure
APPLE_SERVICE_IDandAPPLE_TEAM_IDare set - Restart the app completely (hot reload doesn't apply
.envchanges) - On Android, the button may be hidden by design (Apple's guidelines)
2. Sign In fails with "Invalid configuration"
- Verify Sign In with Apple capability is enabled in:
- Apple Developer Portal (App ID)
- Xcode (Signing & Capabilities)
- Check that your app's bundle ID matches the one in Apple Developer Portal
- Ensure your Apple Developer membership is active
3. "Authorization failed" error
- User may have cancelled the sign-in
- Check that the Services ID is correctly configured
- Verify return URLs are properly set in Apple Developer Portal
4. Works on iOS but fails on Android
- Ensure Services ID is configured with correct return URLs
- Check that your backend supports Apple's web-based authentication flow
- Verify your website domain is properly configured in Apple Developer Portal
Getting Help
If you encounter any issues:
- Check the Apple Developer Documentation
- Review the sign_in_with_apple package documentation
- Check your app's logs for detailed error messages
Security Considerations
- Never commit your Apple Developer credentials to version control
- Always use environment variables for sensitive data
- Implement proper error handling and user feedback
- Apple Sign In provides privacy features (Hide My Email) - respect user choices
