Rename Unintuitive Function Names in Authentication Flow (#9706)

Resolves #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 <charles@twenty.com>
This commit is contained in:
Samyak Piya
2025-01-24 13:19:14 -05:00
committed by GitHub
parent 570b2e3530
commit 55be726105
19 changed files with 300 additions and 259 deletions

View File

@ -10,11 +10,11 @@ const auth = {
describe('AuthResolve (integration)', () => {
let loginToken: string;
it('should challenge with email and password', () => {
it('should getLoginTokenFromCredentials with email and password', () => {
const queryData = {
query: `
mutation Challenge {
challenge(email: "${auth.email}", password: "${auth.password}") {
mutation GetLoginTokenFromCredentials {
getLoginTokenFromCredentials(email: "${auth.email}", password: "${auth.password}") {
loginToken {
token
expiresAt
@ -33,7 +33,7 @@ describe('AuthResolve (integration)', () => {
expect(res.body.errors).toBeUndefined();
})
.expect((res) => {
const data = res.body.data.challenge;
const data = res.body.data.getLoginTokenFromCredentials;
expect(data).toBeDefined();
expect(data.loginToken).toBeDefined();
@ -42,11 +42,11 @@ describe('AuthResolve (integration)', () => {
});
});
it('should verify with login token', () => {
it('should getAuthTokensFromLoginToken with login token', () => {
const queryData = {
query: `
mutation Verify {
verify(loginToken: "${loginToken}") {
mutation GetAuthTokensFromLoginToken {
getAuthTokensFromLoginToken(loginToken: "${loginToken}") {
tokens {
accessToken {
token
@ -66,7 +66,7 @@ describe('AuthResolve (integration)', () => {
expect(res.body.errors).toBeUndefined();
})
.expect((res) => {
const data = res.body.data.verify;
const data = res.body.data.getAuthTokensFromLoginToken;
expect(data).toBeDefined();
expect(data.tokens).toBeDefined();