Apple
Prerequisites
Before you begin, ensure you have the following:
- Apple Developer Account: If you don’t have one, enroll here.
Creating a New App ID
1. Log in to the Apple Developer Console
- Action:
- Visit Apple Developer and sign in with your Apple ID.
2. Navigate to Identifiers
- Go to Certificates, Identifiers & Profiles.
- Click on Identifiers in the sidebar.
3. Create a New App ID
- Click the ”+” button to add a new identifier.
- Select App IDs and click Continue.
- Choose App and click Continue.
- Enter a Description for your App ID (e.g.,
LibreChat App ID
). - Set the Bundle ID (e.g.,
com.yourdomain.librechat
). - Click Continue and then Register.
-
Image References:
-
Figure 1: Creating a New App ID
-
Figure 2: Selecting App Identifier
4. Enable “Sign in with Apple”
- After creating the App ID, click on it to edit.
- Under Capabilities, find and check Sign in with Apple.
- Click Save.
- Image Reference:
Figure 3: Enabling “Sign in with Apple”
Creating a Services ID
1. Navigate to Identifiers
- In the Certificates, Identifiers & Profiles section, click on Identifiers.
2. Create a New Services ID
- Click the ”+” button.
- Select Services IDs and click Continue.
- Enter a Description (e.g.,
LibreChat Services ID
). - Enter an Identifier (e.g.,
com.yourdomain.librechat.services
). - Click Continue and then Register.
-
Image References:
-
Figure 4: Selecting Services ID
-
Figure 5: Creating Services ID
3. Configure “Sign in with Apple”
- Click on the newly created Services ID.
- Under Capabilities, click Configure next to Sign in with Apple.
- Enter your Domains (e.g.,
your-domain.com
) and Return URLs (e.g.,https://your-domain.com/oauth/apple/callback
). - Click Next and then Register.
-
Image Reference:
-
Figure 6: Configuring “Sign in with Apple” for Services ID
-
Figure 7: Web Authentication Configuration
-
Figure 8: Save edit Services ID Configuration
Creating a Key
1. Navigate to Keys
- In the Certificates, Identifiers & Profiles section, click on Keys.
2. Create a New Key
- Click the ”+” button to add a new key.
- Enter a Key Name (e.g.,
LibreChatSignInWithApple
). - Select Sign in with Apple under Capabilities.
- Click Configure and select the created App ID (e.g.,
com.yourdomain.librechat
), then click Save. - Click Continue and then Register.
-
Image References:
-
Figure 8: Creating a New Key
-
Figure 9: Configuring the Key with App ID
-
Figure 10: Registering the Key
3. Download the Private Key
- After creating the key, click Download.
- Important: Save the
.p8
file securely. You will not be able to download it again. - Note the Key ID; you’ll need it for the
.env
file.
- Image Reference:
Figure 11: Downloading the Private Key
Configuring LibreChat
1. Update .env
Configuration
Add the following Apple OAuth2 configuration to your .env
file:
DOMAIN_CLIENT=https://your-domain.com # use http://localhost:3080 if not using a custom domain
DOMAIN_SERVER=https://your-domain.com # use http://localhost:3080 if not using a custom domain
# Apple
APPLE_CLIENT_ID=com.yourdomain.librechat.services
APPLE_TEAM_ID=YOUR_TEAM_ID
APPLE_KEY_ID=YOUR_KEY_ID
APPLE_PRIVATE_KEY_PATH=/path/to/AuthKey.p8 # Absolute path to your downloaded .p8 file
APPLE_CALLBACK_URL=/oauth/apple/callback
Note:
- Replace
com.yourdomain.librechat.services
with your actual Services ID.- Replace
YOUR_TEAM_ID
andYOUR_KEY_ID
with the respective values from your Apple Developer account.- If using Docker, ensure the
.p8
file is accessible within your Docker container and update theAPPLE_PRIVATE_KEY_PATH
accordingly.
2. Restart LibreChat
After updating the .env
file, restart LibreChat to apply the changes.
- If using Docker:
docker compose up -d
Troubleshooting
If you encounter issues during the setup, consider the following solutions:
-
Invalid Redirect URI:
- Ensure that the redirect URI in your Apple Developer Console (
https://your-domain.com/oauth/apple/callback
) matches exactly with the one specified in your.env
file (APPLE_CALLBACK_URL
).
- Ensure that the redirect URI in your Apple Developer Console (
-
Private Key Issues:
- Verify that the path to your
.p8
file (APPLE_PRIVATE_KEY_PATH
) is correct. - Ensure that LibreChat has read permissions for the
.p8
file.
- Verify that the path to your
-
Team ID and Key ID Errors:
- Double-check that the
APPLE_TEAM_ID
andAPPLE_KEY_ID
in your.env
file match those in your Apple Developer Account.
- Double-check that the
-
Domain Verification Failed:
- Ensure that the verification file is correctly uploaded to the root of your domain.
- Verify that there are no typos in the domain name entered during configuration.
-
Docker Configuration Issues:
- If using Docker, confirm that the
.p8
file is properly mounted and the path inAPPLE_PRIVATE_KEY_PATH
is accessible within the container.
- If using Docker, confirm that the
-
Check Logs:
- Review LibreChat logs for any error messages related to Apple authentication. This can provide specific insights into what might be going wrong.