# Sign in with Apple

# Prerequisites

You need to prepare the following in total:

  1. Register a developer account at Apple Developer (opens new window).
  2. Register your iOS app on the Apple Developer Portal, please record the following ID and Key: Bundle ID, Apple Team ID, Key ID, Signing Key, then you need to fill in the Authing console form.
  3. Configure Sign in with Apple Social Connection in Authing Console

# Configure Sign in with Apple social connection in the Authing console

In the Authing console Connect Identity Source -> Social Login page, find Sign in with Apple in Mobile Login:

Please fill in Bundle ID, Apple Team ID, Key ID and Signing Key respectively:

Click the Save button.

# API Refrence

Here we recommend reading the official guidelines provided by Apple: Implementing User Authentication with Sign in with Apple (opens new window), download the sample Demo program:

Please make sure that the Bundle ID and the application you created in Apple Developer (opens new window) Bundle ID (For details, please see: Register your iOS application) consistent:

# Get authorizationCode

Modify the authorizationController method in LoginViewController.swift, you can get the authorizationCode in appleIDCredential, and use the authorizationCode to exchange user information:

if let authorizationCode = String(bytes: appleIDCredential.authorizationCode!, encoding: .utf8) {
} else {
    print("not a valid UTF-8 sequence")

# Exchange for user information

After getting the authorizationCode, you can call the Authing interface in exchange for the user's information:


Use authorizationCode in exchange for user information.

Path Paramter

User pool ID

Body Paramter


200: OK

The user information that Authing returns to the developer is the processed Authing user standard fields, not the user fields described in the WeChat document. For detailed user field definitions, please see: User profile field definitions

  "code": 200,
  "message": "Getting user information successfully",
  "data": {
    "id": "5fb7c7d8ee96c20ca71b6d56",
    "email": "test@example.com",
    "emailVerified": true,
    "unionid": "social:apple:001963.663e421e52eb4e1eac34d366fe0da7be.1229",
    "openid": "social:apple:001963.663e421e52eb4e1eac34d366fe0da7be.1229",
    "oauth": "{\"id\":\"001963.663e421e52eb4e1eac34d366fe0da7be.1229\",\"email\":\"test@example.com\",\"emailVerified\":true}",
    "registerSource": [
    "username": null,
    "nickname": null,
    "company": null,
    "photo": "https://files.authing.co/authing-console/default-user-avatar.png",
    "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9",
    "phone": null,
    "tokenExpiredAt": "2020-12-06T04:10:44.664Z",
    "loginsCount": 4,
    "signedUp": "2020-11-20T13:42:48.477Z",
    "blocked": false,
    "isDeleted": false,
    "userPoolId": "xxxxx"

# Next

After obtaining the user information, you can get the login credential token. You can carry this token in subsequent API requests, and then distinguish different users based on this token in the backend interface. For details, see [Verification token](../ ../advanced/verify-jwt-token.md#yan-zheng-authing-qian-fa-de-token).