`startLogin` doesn't work for Patient users
# support
p
Hi Wonderful Medplum Folks - We have been making some progress with using Medplum and had some questions about this SDK method https://www.medplum.com/docs/sdk/core.medplumclient.startlogin. 1. We are using this method with Practitioners & login process works fine. However, when we are using this method with Patients, it gives an error. Just trying to understand if this method is designed just for Practitioners or for Patients as well. 2. We are calling startLogin as below & it works. You will note that there is no client id or project id. Does this mean that email addresses are globally unique? How does Medplum know about the project to which the user belongs? Thanks for the help. const loginRequest: EmailPasswordLoginRequest = { email, password, }; const loginResponse = await medplum.startLogin(loginRequest); const loginToken = await medplum.processCode(loginResponse.code as string);
r
Hi @pankaj_81531 , I believe you are running into the the difference between server-scoped users and project-scoped users (https://www.medplum.com/docs/auth/user-management-guide#users)
By default, Practitioner users are server- scoped, and
Patient
users are project scoped
My rec would be to include a
clientId
when logging in from a front-end app. In general, all client apps should include a client id, to make them easier to administer
p
@rahul1 - Perfect! Thanks for the clarification. That answers my question. As always, impressed by how well thought medplum is. Thanks for your help & more power to you guys!
r
Thank you so much for the kind words @pankaj_81531