ReactPy websocket authentication has failed! #153
-
I'm using 'allauth' in my Django project. While loading a 'Hello world' component from a template (which does show up on the page), I get the following error. There are many moving parts, so please let me know what other details you might need. ReactPy websocket authentication has failed!
Traceback (most recent call last):
File "PATH/venv/lib/python3.11/site-packages/channels/auth.py", line 95, in login
backend = backend or user.backend
^^^^^^^^^^^^
File "PATH/venv/lib/python3.11/site-packages/django/utils/functional.py", line 268, in inner
return func(_wrapped, *args)
^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'User' object has no attribute 'backend'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "PATH/venv/lib/python3.11/site-packages/reactpy_django/websocket/consumer.py", line 37, in connect
await login(self.scope, user)
File "PATH/venv/lib/python3.11/site-packages/asgiref/sync.py", line 479, in __call__
ret: _R = await loop.run_in_executor(
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "PATH/venv/lib/python3.11/site-packages/channels/db.py", line 13, in thread_handler
return super().thread_handler(loop, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "PATH/venv/lib/python3.11/site-packages/asgiref/sync.py", line 538, in thread_handler
return func(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^
File "PATH/venv/lib/python3.11/site-packages/channels/auth.py", line 101, in login
raise ValueError(
ValueError: You have multiple authentication backends configured and therefore must provide the `backend` argument or set the `backend` attribute on the user. # In settings.py:
AUTHENTICATION_BACKENDS = [
# Needed to login by username in Django admin, regardless of `allauth`
'django.contrib.auth.backends.ModelBackend',
# `allauth` specific authentication methods, such as login by e-mail
'allauth.account.auth_backends.AuthenticationBackend',
] Using: reactpy==1.0.1 |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
@Archmonger, perhaps related to #151? |
Beta Was this translation helpful? Give feedback.
-
Resolved via this PR, will be released as You will need to define
|
Beta Was this translation helpful? Give feedback.
Resolved via this PR, will be released as
v3.2.0
shortly.You will need to define
REACTPY_AUTH_BACKEND
assuming that...AuthMiddlewareStack
and...AUTHENTICATION_BACKENDS
setting and...backend
attribute