Help Needed: Dynamically Fetching constituentId After Login

Hi everyone,

I'm currently working on a project where I’ve implemented user login and authorization successfully. Once a user logs in, the application routes them to a specific page and makes a fetch request like this: fetch('/api/constituents/280')
Right now, the 280 is hardcoded as the constituentId, but I want to make this dynamic. The goal is to automatically fetch and use the logged-in user’s actual constituentId instead of relying on a hardcoded value.

What I Need to Know:

Where or how can I retrieve the correct constituentId after login?

Should it be returned as part of the login response (e.g., in a token or user object)?

Is there a standard pattern or best practice to securely pass and use this value in subsequent API calls?

Categories