-
Notifications
You must be signed in to change notification settings - Fork 270
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SimpleJWT integration doesn't take into account the settings AUTH_HEADER_NAME #474
Comments
Hi, this should actually already be fixed in |
I think it fixed only the type (JWT, Bearer), not the header name : While using a custom name : But using this (custom class for my project):
Note that as its not the Authorization header, it cannot append Bearer, and client will need to do that manually. |
Wait, lemme check with the most updated version, I may an older one. |
the code snippet you posted is not the current state of the code:
this was changed prior to |
Due to limitations in the OpenAPI 3.0.3 specification, you need to actually prefix the That means you need to put |
I may need to check out but right know the header is not recognized (other way it would also say wrong credential), even with Bearer. I'll try out by changing the name |
i suggest trying to construct a curl command that works and work back from there. all i can think of at this point is maybe the casing of the header name, but that should in theory work as it does for |
Using Curl : ➜ ioc git:(develop) ✗ curl -X 'GET' \
|
ok so this is a django/nginx gotcha: headers containing underscores are discarded apparently. we would need to convert |
Exactly (I was surpised by not being able to see the header in the meta field ^^'). ! |
that should do it. release will take circa 2 weeks as i like to collect a few issues per release. please test if the fix works as expected. |
Works fine for me with this code :). |
Hi, just figuring this out today because I had to use a custom header for simplejwt auth
Describe the bug
SimpleJwt can be configured by using a dict in the settings.py of a django project.
SIMPLE_JWT = { 'AUTH_HEADER_NAME' : "HTTP_X_TOKEN" # translate to X-token as header. }
But the current implementation doesn't take this settings into account :
`class SimpleJWTScheme(OpenApiAuthenticationExtension):
target_class = 'rest_framework_simplejwt.authentication.JWTAuthentication'
name = 'jwtAuth'
Where the return should become something I guess like
{'type':'apiKey', 'in': 'header', 'name': api_settings.SIMPLE_JWT['AUTH_HEADER_NAME']}
To Reproduce
Change simplejwt header setting.
Expected behavior
Authentication should scheme should follow simplejwt settings.
I may have time to make a PR if needed.
The text was updated successfully, but these errors were encountered: