When testing the invite endpoint with an Admin account, I encountered the following error:
{
"traceId": "84b33c28-1242-40ef-a0bb-f7d27393972a",
"statusCode": 503,
"message": "Cannot read properties of null (reading 'firstName')",
"timestamp": "2025-04-09T19:48:50.718Z",
"requestUrl": "/api/v1/admins/inviteLead/joelolawanle%40gmail.com"
}
Also, this should be a POST request (not a GET), since it creates a new user and sends an invite.
If I understand the logic correctly, when the Admin (or super admin) sends an invite:
- A new user is created in the database (
email, userId, userRole, status = PENDING)
- An invite token is generated and tied to this user (we also need to think of how to manage this as it would expire right maybe after 24hrs — would it be stored in a db table or?)
- An email is sent to the user with a link like:
https://inventors.dev/admin/complete-profile?token=abc123xyz
On the frontend, we’ll need to validate that token when the user clicks the invite link and hits the /complete-profile route. Typically, we’d send the token to a backend endpoint to:
- Confirm it’s valid
- Fetch the user’s email or partial profile
- Pre-fill the form before submitting updates
For example:
fetch(`/api/v1/invite/validate?token=${token}`)
Does such an endpoint exist or is it planned? If not, could you point us to the right endpoint for validating invite tokens on the frontend?
One more thing about the invite flow, we’re thinking of keeping the profile completion page outside the dashboard, with a lightweight form (just name and password). Maybe (I am skeptical about the token though):
{
"token": "...",
"firstName": "...",
"lastName": "...",
"password": "..."
}
After submitting, backend finalizes setup by updating user's profile and password, changes status to ACTIVE and I guess mark the token as used.
The user won’t be automatically logged in — instead, they’ll see a success message and can log in later to complete their full profile (e.g. bio, phone, photo).
Just to confirm:
- Will the
/users/{userId} PATCH endpoint work without issuing tokens?
- Are we good to treat this as a non-auth route as long as the invite token is valid? Or are you planning to create a separate endpoint specifically for this profile completion step?
When testing the invite endpoint with an Admin account, I encountered the following error:
Also, this should be a
POSTrequest (not aGET), since it creates a new user and sends an invite.If I understand the logic correctly, when the Admin (or super admin) sends an invite:
email,userId,userRole,status = PENDING)On the frontend, we’ll need to validate that token when the user clicks the invite link and hits the
/complete-profileroute. Typically, we’d send the token to a backend endpoint to:For example:
Does such an endpoint exist or is it planned? If not, could you point us to the right endpoint for validating invite tokens on the frontend?
One more thing about the invite flow, we’re thinking of keeping the profile completion page outside the dashboard, with a lightweight form (just name and password). Maybe (I am skeptical about the token though):
After submitting, backend finalizes setup by updating user's profile and password, changes
statustoACTIVEand I guess mark the token as used.Just to confirm:
/users/{userId}PATCHendpoint work without issuing tokens?