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

Rename Unintuitive Function Names in Authentication Flow #9623

Closed
samyakpiya opened this issue Jan 14, 2025 · 1 comment · Fixed by #9706
Closed

Rename Unintuitive Function Names in Authentication Flow #9623

samyakpiya opened this issue Jan 14, 2025 · 1 comment · Fixed by #9706

Comments

@samyakpiya
Copy link
Contributor

References

This is a follow up to PR #9288. For more context, look at this conversation.

Scope & Context

The functions Verify, Challenge, and their corresponding frontend counterparts (challenge, verify) have unclear and non-intuitive names. This creates confusion for developers working with the authentication flow. Updating these names will improve readability and maintainability of the code.

Current behavior

Currently, the following functions are named in a way that does not clearly indicate their purpose:

  • Backend:
    • Verify: Exchanges a login token for authentication tokens.
    • Challenge: Generates a login token from user credentials.
  • Frontend:
    • challenge: Corresponds to Challenge on the backend.
    • verify: Corresponds to Verify on the backend.

These names can be confusing to developers, as they do not directly describe the functions' behavior.

Expected behavior

Rename the functions to better reflect their purpose. Proposed changes:

  • Backend:
    • VerifyGetAuthTokensFromLoginToken
    • ChallengeGetLoginTokenFromCredentials
  • Frontend:
    • challengegetLoginTokenFromCredentials
    • verifygetAuthTokensFromLoginToken
@yadavshubham01
Copy link
Contributor

assign me this issue

DeepaPrasanna pushed a commit to DeepaPrasanna/twenty that referenced this issue Jan 27, 2025
Resolves twentyhq#9623

## Description

This PR renames the following functions to better reflect their purpose.

- Backend:
  - Verify → GetAuthTokensFromLoginToken
  - Challenge → GetLoginTokenFromCredentials

- Frontend:
  - challenge → getLoginTokenFromCredentials
  - verify → getAuthTokensFromLoginToken

## Testing
_Sign in works as expected:_


https://github.com/user-attachments/assets/7e8f73c7-2c7d-4cd2-9965-5ad9f5334cd3

_Sign up works as expected:_
  

https://github.com/user-attachments/assets/d1794ee4-8b59-4934-84df-d819eabd5224

---------

Co-authored-by: Charles Bochet <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

3 participants