@ -454,6 +454,22 @@ class CourseOnlineClassTokenValidateAPIView(GenericAPIView):
print ( f " [Online Validate GET] user={request.user} " )
print ( f " [Online Validate GET] user={request.user} " )
print ( f " [Online Validate GET] user.is_authenticated={request.user.is_authenticated} " )
print ( f " [Online Validate GET] user.is_authenticated={request.user.is_authenticated} " )
print ( f " [Online Validate GET] user.id={request.user.id if request.user.is_authenticated else ' N/A ' } " )
print ( f " [Online Validate GET] user.id={request.user.id if request.user.is_authenticated else ' N/A ' } " )
print ( f " [Online Validate GET] Authorization Header={request.META.get( ' HTTP_AUTHORIZATION ' , ' NOT FOUND ' )} " )
print ( f " [Online Validate GET] All Headers={dict((k, v) for k, v in request.META.items() if k.startswith( ' HTTP_ ' ))} " )
# Debug: Check if token exists in database
auth_header = request . META . get ( ' HTTP_AUTHORIZATION ' , ' ' )
if auth_header . startswith ( ' Token ' ) :
token_key = auth_header . split ( ' ' ) [ 1 ]
try :
from rest_framework.authtoken.models import Token
token_obj = Token . objects . get ( key = token_key )
print ( f " [Online Validate GET] Token found in DB - user={token_obj.user} user_id={token_obj.user.id} " )
except Token . DoesNotExist :
print ( f " [Online Validate GET] Token NOT found in DB - token={token_key[:10]}... " )
except Exception as e :
print ( f " [Online Validate GET] Token check error - {str(e)} " )
print ( " = " * 80 )
print ( " = " * 80 )
logger . info ( f " [Online Validate GET] Request received - slug={slug} user_id={request.user.id if request.user.is_authenticated else ' anonymous ' } " )
logger . info ( f " [Online Validate GET] Request received - slug={slug} user_id={request.user.id if request.user.is_authenticated else ' anonymous ' } " )