Skip to content

Commit 00a2401

Browse files
committed
fix(headless): don't skip on_authentication_error()
1 parent f1c78c3 commit 00a2401

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

allauth/headless/socialaccount/internal.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def on_authentication_error(
2323
exception=None,
2424
extra_context=None,
2525
state_id=None,
26-
):
26+
) -> None:
2727
"""
2828
Called at a time when it is not clear whether or not this is a headless flow.
2929
"""

allauth/socialaccount/helpers.py

+9-9
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ def render_authentication_error(
2020
extra_context=None,
2121
):
2222
try:
23+
if extra_context is None:
24+
extra_context = {}
25+
get_adapter().on_authentication_error(
26+
request,
27+
provider,
28+
error=error,
29+
exception=exception,
30+
extra_context=extra_context,
31+
)
2332
if allauth_settings.HEADLESS_ENABLED:
2433
from allauth.headless.socialaccount import internal
2534

@@ -31,15 +40,6 @@ def render_authentication_error(
3140
extra_context=extra_context,
3241
)
3342

34-
if extra_context is None:
35-
extra_context = {}
36-
get_adapter().on_authentication_error(
37-
request,
38-
provider,
39-
error=error,
40-
exception=exception,
41-
extra_context=extra_context,
42-
)
4343
except ImmediateHttpResponse as e:
4444
return e.response
4545
if error == AuthError.CANCELLED:

0 commit comments

Comments
 (0)