1
votes

im trying to integrate React , django and django channels together , however im facing some trouble trying to authenticate the socket connection.

There are some posts over here: first link enter link description here

But they do not talk about how to utilize it over the front end portion.

There are some posts which recommends to put the token within the URL , for example :

WebSocket('wss://example.com/my-ws-endpoint/?token=' + token, ...)

But there seems to be lots of security red flags in doing so. Therefore is there a simple easy way to resolve the token authentication issue for channel websockets here?

1

1 Answers

0
votes

Please take a look at this. It uses a http-proxy middleware to put the token in the request header instead of putting it within the URL. Also, you can read about a good method of authentication in Django channels in this post.