79349798

Date: 2025-01-12 11:22:10
Score: 1
Natty:
Report link

My approach was (this way we can have a little more manual control):

from allauth.headless.account.views import SessionView

class get_user_from_sessionview(SessionView):
    def dispatch(self, request, *args, **kwargs):
        return request.user

then, we can easily use it like this:

get_user_from_sessionview.as_api_view(client='app')(request) # client is either 'app' or 'browser'

If I remember correctly, it returned the user object.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: Coding Guy