This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.auth.models import AnonymousUser | |
from rest_framework.authtoken.models import Token | |
from channels.db import database_sync_to_async | |
from channels.middleware import BaseMiddleware | |
from project.settings import SIMPLE_JWT, SECRET_KEY | |
@database_sync_to_async | |
def get_user(token_key): | |
# If you are using normal token based authentication | |
try: |