Apple SSO breaks after Django 4 upgrade

60 views Asked by At

After upgrading from django 3 to django 4, the "Sign in with Apple" feature started breaking with the following error

Your request could not be completed because of an error. Please try again later.

enter image description here

The javascript, the frontend html, and the Apple ID url are all identical, and there is no useful error in the console. What is going on?

1

There are 1 answers

0
wonton On

So it turns out that Django 4 added a new setting called SECURE_CROSS_ORIGIN_OPENER_POLICY which sets the Cross-Origin-Opener-Policy header to same-origin.

Adding the following line to my django settings module resolved the issue for me

SECURE_CROSS_ORIGIN_OPENER_POLICY = "same-origin-allow-popups"

I am not sure why they did this because the default browser value is unsafe-none, and the browser error console was not very helpful.