<a id="appleid"></a>

# AppleID

<a id="backend-class"></a>

## Backend class

For Django, add this class path to `AUTHENTICATION_BACKENDS`. For other
integrations, use the same class path in the framework-specific backend
setting.

| Backend name   | Class path                               |
|----------------|------------------------------------------|
| `apple-id`     | `social_core.backends.apple.AppleIdAuth` |

Apple ID implemented OAuth2 and OpenID Connect protocols for their authentication mechanism. To
enable `python-social-auth` support follow this steps:

1. Go to [Apple Developer Portal](https://developer.apple.com/) and
   1. [Create or select an existing App ID](https://help.apple.com/developer-account/?lang=en#/devde676e696)
   2. [Create a Sign Certificate](https://help.apple.com/developer-account/?lang=en#/dev77c875b7e)
   3. [Create a Services ID](https://help.apple.com/developer-account/?lang=en#/dev1c0e25352), activate “Sign In with Apple” and grant your “return URLs”
2. Fill App Id and Secret in your project settings:
   ```default
   SOCIAL_AUTH_APPLE_ID_CLIENT = '...'             # Your client_id com.application.your, aka "Service ID"
   SOCIAL_AUTH_APPLE_ID_TEAM = '...'               # Your Team ID, ie K2232113
   SOCIAL_AUTH_APPLE_ID_KEY = '...'                # Your Key ID, ie Y2P99J3N81K
   SOCIAL_AUTH_APPLE_ID_SECRET = """
   -----BEGIN PRIVATE KEY-----
   MIGTAgE.....
   -----END PRIVATE KEY-----"""
   SOCIAL_AUTH_APPLE_ID_SCOPE = ['email', 'name']
   SOCIAL_AUTH_APPLE_ID_EMAIL_AS_USERNAME = True   # If you want to use email as username
   ```
3. Enable the backend:
   ```default
   SOCIAL_AUTH_AUTHENTICATION_BACKENDS = (
       ...
       'social_core.backends.apple.AppleIdAuth',
       ...
   )
   ```

Further documentation at [Website Developer Guide](https://developer.apple.com/documentation/signinwithapplerestapi/authenticating_users_with_sign_in_with_apple) and [Getting Started](https://developer.apple.com/sign-in-with-apple/get-started/).
