User authorization is a vital part of any business application. Every developer faces the authorization challenge. There are many ways to implement authorization in Django. Django has a built-in permission-based authorization system, and there are some third-party apps like django-guardian
and django-rules
.
In our previous article, we implemented Token-based authentication with django-graphql-jwt
. It has also some useful decorators to implement authorization.
But in this article, I will share a custom way to implement role-based authorization in GraphQL. Maybe in the next article, I will share some other ways of authorizations with Django’s built-in permission module.
Let’s start writing some code.