-
Notifications
You must be signed in to change notification settings - Fork 45
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
Is JWT tokens authorization handling possible? #83
Comments
Hello, If you are interested only in webauthn, i think django-passkeys will be easier to integrate. It already has a JSON interface, so it shall be easier as well to integrate with a frontend framework. Give it a try, and I can help you to integrate it, and we can merge this in the main library. To Solve your issue, you can add a middleware that converts the Bearer token to a request.user, or wrap begin_reg with a custom function that does the conversion and call it from your frontend, so django-mfa2 can work as expected. |
We decided to use django-mfa2 as it's more mature than django-passkeys and has email OTP feature. I'll try wrapping begin_reg witha custom api endpoint and pass request.user there and write you back if it succeeded. Probably the same is necessary for complete_reg, authenticate_begin and complete_auth right? |
Yes, sure, if you like you can submit a PR. |
I'll show you how I was able to make JWT auth work with the django-mfa2 code. Maybe other folks will find it helpful how to use JWT with the lib. I think it's good to think about rewriting of your lib into JWT handling as I believe the most of users will have My wrappers (anonymized) custom begin registration
` complete reg
|
Hey,
I'd like to use webauthn(Fido2) in my app as mfa (second step). App consists of django BE and will consist of FE app (vue probably). That's why we decided to use JWT tokens authorization. Is it possible with this lib? I see everywhere in Readme and code the session based authentication method.
I'm using rest_framework_simplejwt.authentication.JWTAuthentication as DEFAULT_AUTHENTICATION_CLASSES. I tried starting Fido2 device registartion by mfa/fido2/begin_reg endpoint by it looks it's not authenticating user by Bearer token and user is seen in the endpoint as AnonymousUser. In other endpoints the user is properly authenticated by JWT access token
The text was updated successfully, but these errors were encountered: