Skip to content

Commit 253a15f

Browse files
authored
Update apple.py
1 parent 630ebfa commit 253a15f

File tree

1 file changed

+5
-13
lines changed

1 file changed

+5
-13
lines changed

src/satosa/backends/apple.py

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -203,19 +203,11 @@ def response_endpoint(self, context, *args):
203203
backend_state = context.state[self.name]
204204

205205
# Apple sends some user information only via POST in the first request
206-
if "user" in context.request:
207-
userinfo = json.load(context.request["user"])
208-
userinfo["name"] = " ".join(
209-
filter(
210-
None,
211-
[
212-
userinfo.get("firstName", ""),
213-
userinfo.get("middleName", ""),
214-
userinfo.get("lastName", ""),
215-
],
216-
)
217-
)
218-
else:
206+
# https://developer.apple.com/documentation/sign_in_with_apple/sign_in_with_apple_rest_api/authenticating_users_with_sign_in_with_apple
207+
try:
208+
userdata = context.request.get("user", "{}")
209+
userinfo = json.load(userdata)
210+
except Exception as e:
219211
# Apple has no userinfo endpoint
220212
userinfo = {}
221213

0 commit comments

Comments
 (0)