Apple Sign-In
Sign in to a web or iOS app with an Apple Account. Mini programs are not supported.
Step 1: Copy the callback URL
The Service ID Return URL must be the CloudBase callback URL. Copy it first and keep the page open.
-
Find Apple sign-in and click "Edit".

-
In "Identity provider settings", copy the callback URL.

Step 2: Configure Apple Developer
Record the Team ID
Open Membership and record the Team ID.

Create an App ID
iOS uses the App ID. Record its Bundle ID.
-
Open Identifiers and click "+".

-
Select App IDs and click "Continue".

-
Select the app type and click "Continue".

-
Fill in "Description" and "Bundle ID", then select "Sign in with Apple". Record the Bundle ID.

-
Click "Continue", confirm the details, and click "Register".

Create a Service ID
Web sign-in uses the Service ID. Enter this value as the Client ID in the console.
-
Open Services IDs, click "+", select Services IDs, and click "Continue".

-
Fill in "Description" and "Identifier", click "Continue", then click "Register".


-
Open the Service you just created, select "Sign in with Apple", and click "Configure".

-
For "Primary App ID", select the App ID you just created.
-
For "Domains and Subdomains", enter the domain from the callback URL. Add any custom domains as well.


-
For "Return URLs", enter the callback URL copied in Step 1.
-
Click "Save", "Continue", and "Register", then record the Service ID.

Create a key
This key signs the Client Secret.
-
Open Keys and click "+".

-
Enter a name, select "Sign in with Apple", and click "Configure". For "Primary App ID", select the App ID you just created.


-
Click "Save", "Continue", and "Register". Record the Key ID, then click "Download" to download the
.p8private key.
The .p8 private key can be downloaded only once. If it is lost, create a new key.
Step 3: Generate the Client Secret
The Client Secret is a JWT (JSON Web Token) signed with the .p8 private key.
It is valid for at most 180 days. Generate a new one before it expires and update the Client Secret in the console.
Install the dependency:
pip3 install PyJWT cryptography
Replace the four values below, run the script, and copy the printed JWT.
import time
import jwt
TEAM_ID = "" # Team ID from the Membership page
CLIENT_ID = "" # Service ID
KEY_ID = "" # Key ID from the Keys page
PRIVATE_KEY_PATH = "" # Path to the .p8 file
with open(PRIVATE_KEY_PATH) as f:
private_key = f.read()
now = int(time.time())
client_secret = jwt.encode(
{
"iss": TEAM_ID,
"iat": now,
"exp": now + 86400 * 180,
"aud": "https://appleid.apple.com",
"sub": CLIENT_ID,
},
private_key,
algorithm="ES256",
headers={"kid": KEY_ID},
)
print(client_secret)
| Setting | Value |
|---|---|
TEAM_ID | Team ID from the Membership page |
CLIENT_ID | Service ID |
KEY_ID | Key ID from the Keys page |
PRIVATE_KEY_PATH | Path to the .p8 file |
Step 4: Enable Apple sign-in
Return to the configuration page from Step 1, fill in the identity provider, then save and enable it.


| Field | Value |
|---|---|
| Client ID | Service ID created in Step 2 |
| Client Secret | JWT printed in Step 3 |
| Scope | openid email name by default; change it if needed |

Finish account linking, then save and enable the identity provider.
