From 51a185fd9954ed934cddd9d64fea0de012b33363 Mon Sep 17 00:00:00 2001 From: Devin Flood Date: Wed, 25 Mar 2026 14:34:42 -0700 Subject: [PATCH 1/2] Update save user endpoint to v2, save user data in both sign in and sign up flows --- .gitignore | 2 +- app/pages/Auth/SignUpPage.tsx | 2 +- app/utils/AuthService.ts | 18 +++++++++++++----- app/utils/useAppContext.tsx | 6 +++--- 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index c8783acef..d28941d6e 100644 --- a/.gitignore +++ b/.gitignore @@ -10,6 +10,6 @@ app/utils/config.js config.yml .DS_Store yarn.lock - +.vscode cypress/videos/** cypress/screenshots/** diff --git a/app/pages/Auth/SignUpPage.tsx b/app/pages/Auth/SignUpPage.tsx index fe5c3e8ea..5d2bb349b 100644 --- a/app/pages/Auth/SignUpPage.tsx +++ b/app/pages/Auth/SignUpPage.tsx @@ -48,7 +48,7 @@ export const SignUpPage = () => { We want to make sure that your account information is safe, so you will be sent a verification code to your email each time you log in. Please enter in your email address and then check your email to find - a 5-number verification code. + a 6 digit verification code.

{ - passwordlessLogin(authClient, email, verificationCode); - // Store user sign up data, which will be saved to our backend after Auth0 success redirect - setUserSignUpData({ email, name, organization }); + passwordlessLogin( + authClient, + email, + verificationCode, + { email, name, organization }, + ); }; /** This method initiates the log-in/sign-up process by sending a code @@ -99,7 +102,8 @@ export const passwordlessStart = (authClient: WebAuth, email: string) => { export const passwordlessLogin = ( authClient: WebAuth, email: string, - verificationCode: string + verificationCode: string, + userSignUpData?: UserSignUpData ) => { const stateToken = createStateToken(); sessionStorage.setItem("authStateToken", stateToken); @@ -117,6 +121,10 @@ export const passwordlessLogin = ( } } ); + // Store user sign up data, which will be saved to our backend after Auth0 success redirect + setUserSignUpData( + userSignUpData ?? { email, name: '', organization: null } + ); }; export const logout = ( @@ -154,7 +162,7 @@ export const saveUser = ( authToken: string ) => { return post( - "/api/users", + "/api/v2/users", { ...userSignUpData, user_external_id: userExternalId }, { Authorization: `Bearer ${authToken}` } ); diff --git a/app/utils/useAppContext.tsx b/app/utils/useAppContext.tsx index 5eec79b57..beb06785c 100644 --- a/app/utils/useAppContext.tsx +++ b/app/utils/useAppContext.tsx @@ -96,11 +96,11 @@ export const AppProvider = ({ // If the SessionCacher has userSignUpData object, that means a user has just been created // in Auth0 and a redirect has occurred. Therefore, we save the new user data to our database. // The authState must also have propagated or else we won't have the token yet. - const newUserData = SessionCacher.getUserSignUpData(); - if (newUserData && authState) { + const userData = SessionCacher.getUserSignUpData(); + if (userData && authState) { SessionCacher.clearUserSignUpData(); AuthService.saveUser( - newUserData, + userData, authState.user.externalId, authState.accessTokenObject.token ); From f8c91df10f03996ba2b50852d126721354129a25 Mon Sep 17 00:00:00 2001 From: Devin Flood Date: Wed, 25 Mar 2026 14:43:22 -0700 Subject: [PATCH 2/2] Run prettier --- app/utils/AuthService.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/app/utils/AuthService.ts b/app/utils/AuthService.ts index cbfb2b0db..b48cff3e9 100644 --- a/app/utils/AuthService.ts +++ b/app/utils/AuthService.ts @@ -63,12 +63,11 @@ export const completeUserSignup = ( name: string, organization: string | null = null ) => { - passwordlessLogin( - authClient, + passwordlessLogin(authClient, email, verificationCode, { email, - verificationCode, - { email, name, organization }, - ); + name, + organization, + }); }; /** This method initiates the log-in/sign-up process by sending a code @@ -122,9 +121,7 @@ export const passwordlessLogin = ( } ); // Store user sign up data, which will be saved to our backend after Auth0 success redirect - setUserSignUpData( - userSignUpData ?? { email, name: '', organization: null } - ); + setUserSignUpData(userSignUpData ?? { email, name: "", organization: null }); }; export const logout = (