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

How can a user logging in request re-sending of their auth code? #217

Open
funkybob opened this issue Jun 29, 2023 · 3 comments
Open

How can a user logging in request re-sending of their auth code? #217

funkybob opened this issue Jun 29, 2023 · 3 comments

Comments

@funkybob
Copy link

Describe the bug
When a user is trying to authenticate, the token sent may expire before they have a chance to complete login.
The usual way to address this is provide a button so they can request another token to be sent.

According to the documentation https://django-trench.readthedocs.io/en/latest/endpoints.html#send-the-code
Posting to /code/request:
Triggers sending out a code. If no method specified in the payload user’s primary MFA method will be used.

However, the view class for that:

class MFAMethodRequestCodeView(APIView):
    permission_classes = (IsAuthenticated,)

Meaning you must already be authenticated before you can ask for the code to allow you to authenticate.

All other views in views/base.py are also marked with similar permissions, besides the MFAStepMixin which is marked as AllowAny.

@funkybob
Copy link
Author

For now we're working around this by re-posting the credentials to the login endpoint.

@nefrob
Copy link

nefrob commented Jun 29, 2023

You could override the _successful_authentication_response function in a custom view and make it return a token with a longer expiration window.

@funkybob
Copy link
Author

That would counteract the purpose of a token timeout in the first place.

If I just wanted a longer timeout, I could change the settings.

I want to be able to send a new token. Like most other 2FA login systems provide the option for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants