I am migrating our Django code that uses djangorestframework-jwt to the latest version of djangorestframework-simplejwt(5.2.2) in Django 4.0.8. I am having an issue while trying to verify the token.
The issue is because of the fact that our pem file for retrieving public and private keys is hosted on an Amazon S3 bucket. The framework requires passing SIGNING_KEY and VERIFYING_KEY statically or using JWK_URL for dynamically injecting these keys. Is there a way to provide these keys dynamically without using JWK_URL?
The djangorestframework-jwt framework used to provide handlers for decoding (JWT_DECODE_HANDLER) and encoding (JWT_ENCODE_HANDLER) the JWT payload. The djangorestframework-simplejwt has built-in functions to decode/encode inside the TokenBackend class. I also see that TOKEN_BACKEND_CLASS is part of REMOVED_SETTINGS in api_settings. I am having difficulty trying to write a custom backend by overriding decode() and encode() functions. How can I accomplish this?
You can achieve this by overriding your serializer in the following fashion.
Hope this helps! Cheers