Sign in and password reset
Email and password sign-in, Google sign-in, forgotten passwords and signing out.
Where it lives
| Route | View file | Access |
|---|---|---|
/auth/signin | src/views/auth/signin.tsx | public |
/auth/google/callback | src/views/auth/google-callback.tsx | public (Google redirects here) |
/auth/forgot-password | src/views/auth/forgot-password.tsx | public |
/auth/reset-password | src/views/auth/reset-password.tsx | public (opened from the reset email) |
Sign-out has no route of its own. It lives in src/components/topbar.tsx and src/components/global-search.tsx. All API calls are thunks in src/services/auth/auth-thunk.ts; the role check is in src/config/roles.ts.
Before you start
- An account with the role agent, landlord or lawyer.
- For Google sign-in, an account the API can match to the Google profile.
Flow
Sign in with email and password
The card is headed "Welcome Back" with "Sign in to manage your listings, clients and deals." It is a two-step form on one route.
-
Email step. Enter Email Address and press Continue.
Rule Message Empty "Email address is required" Must match something@something.somethingwith no spaces"Enter a valid email address" This step also shows Continue with Google and "Don't have an account? Create one" (goes to
/auth/signup). -
Password step. The email is shown with a Change link back to step 1. Enter Password (eye button toggles visibility) and press Sign In. An empty password shows "Password is required". Forgot Password? goes to
/auth/forgot-password. -
The app sends
POST /api/v1/auth/signinwithemail(trimmed) andpassword. The button is disabled and shows a spinner while the request runs. -
On success the thunk stores the response:
Value Kept in data.accessTokensessionStoragekeytokendata.refreshTokenlocalStoragekeyrefreshTokendata.userlocalStoragekeyuser, and Reduxstate.auth.user -
Role check. If the stored user's role is not
AGENT,LANDLORDorLAWYER, the three values are removed again, a toast says "This app is for agents, landlords, and legal partners. Redirecting you to the HomeLinkHub app…" and the browser is sent to the consumer app's/auth/signin. -
Otherwise a toast says "Welcome back!" and, two seconds later, the app navigates:
Who Lands on Agent whose isKYCVerifiedis false/onboardingLawyer /legalEveryone else The saved callback URL ( localStoragekeyhl_callback_url) if there is one, otherwise/The callback URL is read and removed in the same step, whoever signs in.
-
On failure a toast shows the API message, or "Sign in failed. Please try again." The user stays on the password step.
No two-factor step at sign-in
POST /api/v1/auth/signin is treated as fully signed in.Sign in with Google
- On the email step press Continue with Google. The app sends
GET /api/v1/auth/google?app=true. - If the response contains
data.authUrl, the browser leaves the app for that URL (Google's consent screen). - Google returns to
/auth/google/callback?code=...&state=.... The page shows a spinner and "Signing you in with Google..." and sendsGET /api/v1/auth/google/callbackwithcodeandstateas query parameters. The call runs once. - On success the same three values are stored as for password sign-in, the same role check runs, and the app navigates immediately (replacing the history entry): agents who are not KYC verified to
/onboarding, lawyers to/legal, everyone else to/.
| Problem | What the user sees |
|---|---|
No code in the callback URL | Toast "Google sign-in failed. No authorization code received.", then /auth/signin |
| The callback request fails | Toast with the API message, or "Google sign-in failed.", then /auth/signin |
| Role not allowed | The redirect-to-consumer-app toast described above |
Google sign-in shows no "Welcome back!" toast and ignores the saved callback URL.
Forgot password
- Open
/auth/forgot-password("Forgot Password?" on the sign-in password step). The copy reads "Enter your email address and we'll send you a link to reset your password." - Enter Email Address. The field is a browser
emailinput marked required; Send Reset Link is disabled while it is empty. There is no other client-side validation. - Submitting sends
POST /api/v1/auth/forgot-passwordwithemail. - On success the form is replaced by a confirmation: "We've sent a password reset link to" followed by the email, and three notes (check inbox and spam, click the link, "The link will expire in 24 hours").
- Didn't receive email? Resend sends the same request again. Success toast: "Reset link resent. Please check your inbox." Failure toast: the API message, or "Failed to resend. Please try again."
- Back to Sign In returns to
/auth/signin.
A failed first request shows the API message, or "Failed to send reset link. Please try again."
Reset password
The link in the email opens /auth/reset-password?token=.... The heading is "Create New Password".
-
Enter New Password and Confirm Password. Both have show/hide buttons.
Rule Effect New password under 8 characters Reset Password stays disabled Passwords differ "Passwords do not match" under the confirm field; button stays disabled A strength label and bar follow length only: "WEAK" under 8 characters, "MODERATE" for 8 to 11, "STRONG" for 12 or more.
-
Press Reset Password. The app sends
POST /api/v1/auth/reset-passwordwithtokenandpassword. -
On success the heading changes to "Password Reset" with "Your password has been successfully reset. You can now sign in with your new password." Sign In goes to
/auth/signin. The user is not signed in automatically. -
On failure a toast shows the API message, or "Failed to reset password. Please try again."
The requirements box is advisory
Sign out
There are three ways to sign out, and they do not behave the same.
| Entry point | What it does |
|---|---|
| Topbar profile menu, Logout | Sends POST /api/v1/auth/signout with the stored refreshToken. On success removes token, refreshToken and user and clears the Redux user. Then navigates to /auth/signin. |
| Global search, Log out | Same as the profile menu. |
| Sidebar, Logout | A plain link to /auth/signin. No request is sent and nothing is removed from storage. |
The sidebar Logout does not end the session
sessionStorage, so typing / in the address bar opens the dashboard again. Use the profile menu to sign out properly. Also note that if the sign-out request itself fails, storage is not cleared but the app still shows the sign-in page.States and edge cases
- Missing reset token. Submitting the reset form without
?token=in the URL shows "Reset token is missing. Please use the link from your email." and sends nothing. - Expired session. When an Axios request gets a
401with the messageToken has Expired, the app saves the current path tohl_callback_url, clears the session and hard-redirects to/auth/signin. The next password sign-in returns the user to that path. Details are in the section overview. - New tab. The access token is per tab (
sessionStorage), so a new tab always starts at/auth/signin. - Already signed in. The auth pages do not redirect a signed-in user. Signing in again simply overwrites the stored values.
- Google button while loading. It is disabled while any auth request is in flight.
What happens next
- Unverified agents continue to Onboarding and KYC.
- Agents and landlords land in the app shell on the dashboard home.
- The reset email itself is sent by the API after
POST /api/v1/auth/forgot-password; the client only shows the confirmation.