K
K
k0r0g2021-12-01 13:09:42
Django
k0r0g, 2021-12-01 13:09:42

How to do token authentication in channels?

Hey! I have the main DRF API. Authorization is done via JWT.
The app will have chats. I want messages to come to the websocket.
The documentation says that for authentication you need to write a custom middleware.
There the mechanism how to receive the user from query_string is described.
Question:
1. Is it possible to access cookies in this middleware without passing the token to the query_string?
2. How to deny access if the token is recognized as invalid? (and should it be)

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