State is lost following Apple login via python social auth (AuthStateMissing)
I've added apple-id to a django project that already has facebook & twitter login implemented & working.
From the application you can get to apple, login and then you come back to the /player/social/complete/{backend}/
path. Here there's an AuthStateMissing: Session value state missing
exception.
Sessions are using signed_cookies
, SESSION_COOKIE_SAMESITE
is currently "Lax" but I've tried to set that to None
with no change.
Besides the client/team/key settings I have also defined the following for Apple ID
SOCIAL_AUTH_APPLE_ID_SCOPE = ["email", "name"]
SOCIAL_AUTH_APPLE_ID_EMAIL_AS_USERNAME = (
True # If you want to use email as username
)
I've tried various bits that I've found suggested on here and github issues, like specifying the state
field for session storage. But nothing seems to resolve this issue and I'm not familiar enough with how this library works - I'd hoped it'd "just work" like apple usually suggest!
Try adding following variables in settings.py
SOCIAL_AUTH_REDIRECT_IS_HTTPS = True
You can try this too if the issue still persists
SOCIAL_AUTH_FIELDS_STORED_IN_SESSION = ['state']
SESSION_COOKIE_SECURE = False