How would I go about returning a JWT instead of a token to my frontend?
I can manually create a JWT like so (with the rest_framework_jwt module):
from rest_framework_jwt.settings import api_settings
jwt_payload_handler = api_settings.JWT_PAYLOAD_HANDLER
jwt_encode_handler = api_settings.JWT_ENCODE_HANDLER
def manual_create_JWT(user):
""" Generate JWT token for user and pass back to client. Requires the user to be authenticated. """
payload = jwt_payload_handler(user)
return jwt_encode_handler(payload)
How would I go about returning a JWT instead of a token to my frontend?
I can manually create a JWT like so (with the rest_framework_jwt module):