jazzband/django-rest-knox

AUTH_HEADER_PREFIX

kennedyngigi4 opened this issue · 1 comments

I am trying to set my AUTH_HEADER_PREFIX to Bearer but fails with Error 401 (Unauthorized). My frontend fails to get the Token.

Made the mistake earlier of trying to put the settings variables flat in the settings file. If you look at the top of the page on the documentation, it shows that you have to put them in a dictionary like this:
REST_KNOX = {
'SECURE_HASH_ALGORITHM': 'cryptography.hazmat.primitives.hashes.SHA512',
'AUTH_TOKEN_CHARACTER_LENGTH': 64,
'TOKEN_TTL': timedelta(hours=10),
'USER_SERIALIZER': 'knox.serializers.UserSerializer',
'TOKEN_LIMIT_PER_USER': None,
'AUTO_REFRESH': False,
'EXPIRY_DATETIME_FORMAT': api_settings.DATETME_FORMAT,
}
That fix your problem?