Get user from view returns AnonymousUser
juliGer opened this issue · comments
Hello! I would like to get the user from the view but I can't find a way to do it, since I don't have the IsAuthenticated of django rest the request.user comes as Anonymous, the user I have in the scope since I added it through a middelware
So the question is can I get the user from the view? And if this is how it is done since I was reading the documentation and looking at the files but I can't find something that does this
This is a good point, the authenticated user is not currently injected into the request object when calling views through view_as_consumer
And to do it is very difficult? Because I was looking at the consumers.py file and in the call_view function it generates a request and then calls view(request...)
I try to add doing request.user = self.scope['user'] and I add it correctly but in the view it keeps coming as anonymous. I don't know how line 273 works but apparently the request is not being passed or django is stepping on it
Yer if you could open a PR with this that would epic.