Debian Codegraph @

docs/socialaccount/providers/apple.rst

raw
1 Apple
2 -----
3
4 App registration (create an App ID and then a related Service ID here)
5 https://developer.apple.com/account/resources/identifiers/list
6
7 Private Key registration (be sure to save it)
8 https://developer.apple.com/account/resources/authkeys/list
9
10 Development callback URL
11 http://domain.com/accounts/apple/login/callback/
12
13 Add the following configuration to your settings:
14
15 .. code-block:: python
16
17 SOCIALACCOUNT_PROVIDERS = {
18 "apple": {
19 "APPS": [{
20 # Your service identifier.
21 "client_id": "your.service.id",
22
23 # The Key ID (visible in the "View Key Details" page).
24 "secret": "KEYID",
25
26 # Member ID/App ID Prefix -- you can find it below your name
27 # at the top right corner of the page, or it’s your App ID
28 # Prefix in your App ID.
29 "key": "MEMAPPIDPREFIX",
30
31 "settings": {
32 # The certificate you downloaded when generating the key.
33 "certificate_key": """-----BEGIN PRIVATE KEY-----
34 s3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr
35 3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3cr3ts3
36 c3ts3cr3t
37 -----END PRIVATE KEY-----
38 """
39 }
40 }]
41 }
42 }
43
44 Apple offers two distinct client IDs: a "Bundle ID" and a "Services ID". When
45 the flow is started from a mobile iOS device the bundle ID is used, whereas a
46 web authorization flow uses the services ID as the client ID. If you need to
47 support both client IDs within one project, add an app entry (over at ``APPS``)
48 for each client ID. For the app specifying the bundle ID, add the following to
49 the settings so that this app does not show up on the web::
50
51 "settings": { "hidden": True, ... }
52
53
54 Note: Sign In With Apple uses a slight variation of OAuth2, which uses a POST
55 instead of a GET. Unlike a GET with SameSite=Lax, the session cookie will not
56 get sent along with a POST. If you encounter 'PermissionDenied' errors during
57 Apple log in, check that you don't have any 3rd party middleware that is
58 generating a new session on this cross-origin POST, as this will prevent the
59 login process from being able to access the original session after the POST
60 completes.