fastapi-jwt-auth icon indicating copy to clipboard operation
fastapi-jwt-auth copied to clipboard

allow strictBytes type for secret

Open hampsterx opened this issue 4 years ago • 0 comments

we have a secret key that is in bytes (not utf-8 unfortunately).

PyJWT does this..


def force_bytes(value):
    if isinstance(value, text_type):
        return value.encode('utf-8')
    elif isinstance(value, binary_type):
        return value
    else:
        raise TypeError('Expected a string value')

eg it allows to use bytes for the key.

Modifying type confirms works fine.

hampsterx avatar May 25 '21 04:05 hampsterx