To validate the jwt token of auth0 in django, I use the following code in settings.py
def jwt_get_username_from_payload_handler(payload):
return 'authuser'
JWT_AUTH = {
'JWT_PAYLOAD_GET_USERNAME_HANDLER': jwt_get_username_from_payload_handler,
'JWT_PUBLIC_KEY': PUBLIC_KEY,
'JWT_ALGORITHM': 'RS256',
'JWT_AUDIENCE': API_IDENTIFIER,
'JWT_ISSUER': JWT_ISSUER,
'JWT_AUTH_HEADER_PREFIX': 'Bearer',
}
where authuser is the username. So Instead of writing it directly I want to receive it in request header and pass it. Please help me in customising this function - jwt_get_username_from_payload_handler in such a way. TIA