Skip to content

Commit a7bb9dd

Browse files
committed
Update OAuth setup documentation and settings template for Apple authentication
1 parent 79f5606 commit a7bb9dd

File tree

2 files changed

+62
-8
lines changed

2 files changed

+62
-8
lines changed

docs/oauth-setup.md

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,15 +155,28 @@ You need an Apple Developer account (<https://developer.apple.com>).
155155
- Provider: `Apple`
156156
- Client ID: the **Services ID** identifier (e.g. `org.qgis.plugins.web`)
157157
- Secret key: your **Team ID** (found top-right in the developer portal, 10 chars)
158-
- Key: the **Key ID** shown on the key detail page (10-char identifier, not the `.p8` content)
159-
- Settings: paste the following JSON, replacing the value with the full content of your `.p8` file with newlines as `\n`:
160-
```json
161-
{
162-
"certificate_key": "-----BEGIN PRIVATE KEY-----\nMIGH...\n-----END PRIVATE KEY-----"
163-
}
164-
```
158+
- Key: paste the full content of the downloaded `.p8` file
159+
160+
django-allauth uses the Team ID + Key ID + `.p8` content to generate a JWT client secret dynamically. You also need to set **Key ID** in `qgis-app/settings_local.py` (copy from `settings_local.py.templ`):
161+
162+
```python
163+
SOCIALACCOUNT_PROVIDERS = {
164+
"apple": {
165+
"APP": {
166+
"client_id": "org.qgis.plugins.web",
167+
"secret": "TEAM_ID",
168+
"key": "KEY_ID",
169+
"settings": {
170+
"certificate_key": """-----BEGIN PRIVATE KEY-----
171+
...your .p8 content here...
172+
-----END PRIVATE KEY-----"""
173+
}
174+
}
175+
},
176+
}
177+
```
165178

166-
django-allauth uses the Team ID + Key ID + `.p8` content to generate a JWT client secret dynamically. All credentials are stored in the database via Admin — no changes to `settings_local.py` are required for Apple.
179+
The other fields (Client ID = Services ID, Secret key = Team ID) can also be stored in the DB via Admin as a fallback, but the `certificate_key` must be in settings.
167180

168181
---
169182

qgis-app/settings_local.py.templ

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,44 @@ EMAIL_HOST_USER = "resend"
77
EMAIL_HOST_PASSWORD = ""
88
EMAIL_SUBJECT_PREFIX = '[QGIS Plugins] '
99
DEFAULT_FROM_EMAIL = 'no-reply-plugins@qgis.org'
10+
11+
# -----------------------------------------------------------------------------
12+
# Social authentication — provider overrides
13+
# Only add the sections for providers you are configuring.
14+
# Credentials (Client ID / Secret) are stored in Django Admin, not here.
15+
# See docs/oauth-setup.md for full setup instructions.
16+
# -----------------------------------------------------------------------------
17+
18+
SOCIALACCOUNT_PROVIDERS = {
19+
20+
# GitLab — only needed when connecting to a self-hosted instance.
21+
# Remove or leave commented out to use gitlab.com (the default).
22+
"gitlab": {
23+
"GITLAB_URL": "https://your-gitlab.example.com",
24+
"SCOPE": ["read_user"],
25+
},
26+
27+
# Microsoft — set a specific tenant ID to restrict login to one
28+
# organisation. Use "common" (default) to allow any Microsoft account.
29+
"microsoft": {
30+
"tenant": "common", # or your Directory (tenant) ID
31+
"SCOPE": ["User.Read"],
32+
},
33+
34+
# Apple — certificate_key is the content of the .p8 file downloaded
35+
# from the Apple Developer portal. key is the Key ID (10 chars).
36+
# client_id and secret (Team ID) are stored in Django Admin.
37+
"apple": {
38+
"APP": {
39+
"client_id": "org.your.bundle.web",
40+
"secret": "TEAM_ID_10CHARS",
41+
"key": "KEY_ID_10CHARS",
42+
"settings": {
43+
"certificate_key": """-----BEGIN PRIVATE KEY-----
44+
<paste .p8 content here>
45+
-----END PRIVATE KEY-----"""
46+
},
47+
}
48+
},
49+
}
50+

0 commit comments

Comments
 (0)