Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

346
Views
JWT, how to write about the user's Permission in Django without session?

It had a permission below when my server was cookie-based authentication.

class IsAuthenticatedAndStudentOwner(BasePermission):
    message = 'You must be a student.'
    def has_permission(self, request, view):

        return request.user.is_authenticated() and smart_str(request.user.identity) == 'student'

    def has_object_permission(self, request, view, obj):

        return obj.student.user == request.user

Then, when i use JWT, that request.user returns AnonymousUser.

# login(request, user_obj)
payload = jwt_payload_handler(user_obj)
token = jwt_encode_handler(payload)
data['token'] = token
return data

So, how can i write this permission without session?

over 4 years ago · Santiago Trujillo
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!