Skip to main content

Apple

note

To add Apple as a social sign-in provider, you need an Apple Developer account. Go to Enrolling and Verifying Your Identity with the Apple Developer App to create one.

Follow these steps to add Apple as a social sign-in provider to your project using the Ory Console:

  1. Sign in to Ory Console and select Social Sign-in.

  2. Click the switch next to the Apple logo to start the configuration.

  3. Copy the Redirect URI and save it for later use.

  4. Using an Apple Developer Account, create an app, a service, and a private key.

  5. Copy the Services ID from the Apple registered app to the Client ID field in the form in the Ory Console.

  6. Add the saved Redirect URI from Ory to the Return URLs of the Apple registered application.

  7. In the Scopes field of the form in the Ory Console, add the following scope:

    • email
  8. Copy the following details from your registered application in Apple to the corresponding fields in the Ory Console form:

    • Apple Team Id
    • Apple Private Key Id
    • Apple Private Key
  9. In the Data Mapping field of the form in the Ory Console, add the following Jsonnet code snippet, which maps the desired claims to the Ory Identity schema:

    local claims = {
    email_verified: false,
    } + std.extVar('claims');

    {
    identity: {
    traits: {
    // Allowing unverified email addresses enables account
    // enumeration attacks, if the value is used for
    // verification or as a password login identifier.
    //
    // Therefore we only return the email if it (a) exists and (b) is marked verified
    // by Apple.
    [if 'email' in claims && claims.email_verified then 'email' else null]: claims.email,
    },
    },
    }
    danger

    Don't save secrets such as API keys, credentials, or personal data directly in Jsonnet code snippets. Jsonnet code snippets used for data mapping aren't stored in an encrypted format in The Ory Network.

  10. Click Save Configuration.