django-rest-knox icon indicating copy to clipboard operation
django-rest-knox copied to clipboard

AUTH_HEADER_PREFIX

Open kennedyngigi4 opened this issue 4 years ago • 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.

kennedyngigi4 avatar Apr 19 '21 12:04 kennedyngigi4

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?

NeilduToit13 avatar May 14 '22 19:05 NeilduToit13