sweetjwt/utils.py
def jwt_get_secret_key(payload=None):
    """
    For enhanced security you may want to use a secret key based on user.

    This way you have an option to logout only this user if:
        - token is compromised
        - password is changed
        - etc.
    """
    if api_settings.JWT_GET_USER_SECRET_KEY:
        User = get_user_model()
        try:
            user = User.objects.get(pk=payload.get('user_id'))
        except User.DoesNotExist:
            return ''
        key = str(api_settings.JWT_GET_USER_SECRET_KEY(user))
        return key
    return api_settings.JWT_SECRET_KEY

    For enhanced security you may want to use a secret key based on user.

    This way you have an option to logout only this user if:
        - token is compromised
        - password is changed
        - etc.
    
For enhanced security you may want to use a secret key based on user.
This way you have an option to logout only this user if:
token is compromised
password is changed
etc.
For enhanced security you may want to use a secret key based on user . This way you have an option to logout only this user if : token is compromised password is changed etc .
def jwt_get_secret_key(payload=None):
    if api_settings.JWT_GET_USER_SECRET_KEY:
        User = get_user_model()
        try:
            user = User.objects.get(pk=payload.get('user_id'))
        except User.DoesNotExist:
            return ''
        key = str(api_settings.JWT_GET_USER_SECRET_KEY(user))
        return key
    return api_settings.JWT_SECRET_KEY
def jwt_get_secret_key ( payload = None ) : if api_settings . JWT_GET_USER_SECRET_KEY : User = get_user_model ( ) try : user = User . objects . get ( pk = payload . get ( 'user_id' ) ) except User . DoesNotExist : return '' key = str ( api_settings . JWT_GET_USER_SECRET_KEY ( user ) ) return key return api_settings . JWT_SECRET_KEY
For enhanced security you may want to use a secret key based on user.
For enhanced security you may want to use a secret key based on user .
"""
    For enhanced security you may want to use a secret key based on user.

    This way you have an option to logout only this user if:
        - token is compromised
        - password is changed
        - etc.
    """
payload