V
V
Vyacheslav2020-02-20 21:41:00
Django
Vyacheslav, 2020-02-20 21:41:00

How to fix NOAUTH Authentication required error in Django chat on sockets?

I ported a working chat application with sockets and Django from one system to another, installed dependencies, but to my surprise I got this traceback:

Traceback
WebSocket HANDSHAKING /ws/chat/1/ [127.0.0.1:49742]
Exception inside application: NOAUTH Authentication required.
  File "/home/ubuntu/python_work/emoji-bot-2/django-channels-chat-room/emoji-chat_3_env/lib/python3.6/site-packages/channels/sessions.py", line 183, in __call__
    return await self.inner(receive, self.send)
  File "/home/ubuntu/python_work/emoji-bot-2/django-channels-chat-room/emoji-chat_3_env/lib/python3.6/site-packages/channels/middleware.py", line 41, in coroutine_call
    await inner_instance(receive, send)
  File "/home/ubuntu/python_work/emoji-bot-2/django-channels-chat-room/emoji-chat_3_env/lib/python3.6/site-packages/channels/consumer.py", line 59, in __call__
    [receive, self.channel_receive], self.dispatch
  File "/home/ubuntu/python_work/emoji-bot-2/django-channels-chat-room/emoji-chat_3_env/lib/python3.6/site-packages/channels/utils.py", line 51, in await_many_dispatch
    await dispatch(result)
  File "/home/ubuntu/python_work/emoji-bot-2/django-channels-chat-room/emoji-chat_3_env/lib/python3.6/site-packages/channels/consumer.py", line 73, in dispatch
    await handler(message)
  File "/home/ubuntu/python_work/emoji-bot-2/django-channels-chat-room/emoji-chat_3_env/lib/python3.6/site-packages/channels/generic/websocket.py", line 175, in websocket_connect
    await self.connect()
  File "/home/ubuntu/python_work/emoji-bot-2/django-channels-chat-room/chat/consumers.py", line 13, in connect
    self.channel_name
  File "/home/ubuntu/python_work/emoji-bot-2/django-channels-chat-room/emoji-chat_3_env/lib/python3.6/site-packages/channels_redis/core.py", line 591, in group_add
    await connection.zadd(group_key, time.time(), channel)
  NOAUTH Authentication required.
WebSocket DISCONNECT /ws/chat/1/ [127.0.0.1:49742]

Sockets are implemented in channels==2.4.0. The library for integration with Redisalso installed. On the frontend Socket.IO.
The project is similar to this project from github .
After trying some solutions from google came here. Very important: I have a deadline today .
How to fix this error?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question