Skip to content
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

jwt Authentication class compatibility with drf-spectacular #387

Closed
legitYosal opened this issue May 15, 2021 · 7 comments
Closed

jwt Authentication class compatibility with drf-spectacular #387

legitYosal opened this issue May 15, 2021 · 7 comments
Labels
bug Something isn't working fix confirmation pending issue has been fixed and confirmation from issue reporter is pending

Comments

@legitYosal
Copy link

there is a very strange behavior of drf-spectacular when defining Authentication classes from simple-jwt when you declare JWTAuthentication as default_authentication_class swagger UI authorize button works correctly but when you declare JWTTokenUserAuthentication as default_authentication_class swagger UI authorize button disappears and can not set Bearer token.
Steps to reproduce:
first, create a Django project with rest framework and drf-spectacular and simple jwt installed and configured with documentation guidance.
now go to /api/schema/swagger-ui/ everything works fine
then change authentication classes to:

    'DEFAULT_AUTHENTICATION_CLASSES': (
        # 'rest_framework_simplejwt.authentication.JWTAuthentication',
        'rest_framework_simplejwt.authentication.JWTTokenUserAuthentication',

    )

and refresh boom!! there is no authorize button at all!!! it looks like if you subclass JWTAuthentication class it goes wrong.
I did not know where to post this issue but so posted it on both, can anybody help me to fix drf-spectacular with this authentication class?

@tfranzel
Copy link
Owner

hi, you found yourself a bug. simple oversight. the shipped auth extension does not account for that second class. easy fix

@tfranzel tfranzel added the bug Something isn't working label May 15, 2021
@legitYosal
Copy link
Author

ok I delete the duplicate issue from simple-jwt

@legitYosal
Copy link
Author

@tfranzel when do you think you can fix this?

@tfranzel tfranzel added the fix confirmation pending issue has been fixed and confirmation from issue reporter is pending label May 15, 2021
@tfranzel
Copy link
Owner

please confirm this is working and close the issue. fix will be in the next release

@legitYosal
Copy link
Author

yes, it works flawlessly, you are awesome thank you!

@legitYosal
Copy link
Author

@tfranzel Hi, can you inform me when do you want to release this bug fix??

@tfranzel
Copy link
Owner

@usefss i was/am pretty swamped at the moment. will do it definitely in the next couple of days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fix confirmation pending issue has been fixed and confirmation from issue reporter is pending
Projects
None yet
Development

No branches or pull requests

2 participants