'user not found' with GoogleLogin after multiple r...
# support
c
Hi @rahul_25388 , We have a Practitioner on our project who we invited manually and she used the same email to signup into our other application that created a user with same email but as Patient. the User under project config (https://app.medplum.com/admin/users) links to Practitioner resource . i modified user email of patient record to something else (so to skip conflict/confusion). but when user tried to login we use googlesignin (medplum.startGoogleLogin) and we get 'user not found' . Can you please help us with the issue, also let me know how i can provide you the user details and project details to help you debug . Also on a separate note, How can we restrict specific resource type user to login using startGoogleLogin, example we want only Practitioners to login to our application which uses startGoogleLogin. And how to ensure email uniqueness on a project (example same email cannot we used to create a patient and practitioner ).
r
Hi @charithv , our login model doesn't support sharing an email address between a practitioner and patient login. There are edge cases in this auth flow that make it difficult to support and our guidance is to use a new email when registering as a patient.
One common pattern is to add a
+
symbol to the email address. Eg.
username+patient@example.com
To unblock login for this user, the best situation would be delete teh
User
resource assigned to the patient, and then re-invite the user as a patient under a different email
c
Hi @rahul1 we did that . Delete the User and modified patient and practitioners emails by adding + something and re-inviting the user . User is now able to access medplum dashboard via Google login but can't access our app .
And the user record points to practitioner
r
HI @charithv , I'm having a little bit of trouble understanding the current state, but I'll try to give my best explanation. * There are two types of
Users
- server scoped and project scoped users (https://www.medplum.com/docs/auth/user-management-guide#users) * Your practitioner should be a server scoped
User
. You will not be able to see this this
User
resource, as it requires SuperAdmin privileges * Your patient should be a project-scoped
User
* It is the email on the
User
resource, not the the
Patient
/
Practitioner
> User is now able to access medplum dashboard via Google login but can't access our app . Could you share the error message you are getting, it's hard for me to understand what might be happening. My guess is that we're missing a
User
resource somewhere. ALos, what authentication method does you app use? If you could also share a link to the
User
and
Practitioner
resources, I can take a look at the setup
c
Hi @rahul1 , we use medplum.startGoogleLogin as our Authentication method and we get 'User Not Found' as the error . Here is the User resource that we invited https://app.medplum.com/admin/members/b024b8fa-2278-4d07-9ac6-dc3f5a5391ad and the Practitoner that was linked to this user https://app.medplum.com/Practitioner/59ec5f79-3258-4dfe-9308-949e62a2fe08
r
@charithv can you lnk the the
User
resource.
https://app.medplum.com/User/Id
r
Hi @charithv , I'm seeing 2 users, 1 server-scoped and 1 project-scoped, with the same email. As I mentioned earlier, we currently don't support multiple users with the same email address
Is this user both a practitioner and a patient in your practice? Or is this a test user?
c
User was supposed to be just Practitioner , but she signed up from our patient facing app which created a patient record as well
r
In that case you can delete the patient facing user, User/57ce21bb-f4e7-4c6c-a924-c35759999df8
c
okay so just for understanding Practitioner are server scoped and are under admin/members i.e.., this one links to Practitioner https://app.medplum.com/admin/members/b024b8fa-2278-4d07-9ac6-dc3f5a5391ad the user/id links to a Patient
i can delete the User/57ce21bb-f4e7-4c6c-a924-c35759999df8 now so the user that links to Patient is gone ?
r
yes
c
cool, deleting now , let see if that helps 🤞
r
As I mentioned above, you will not have priviledges to delete the server scoped user
c
User/57ce21bb-f4e7-4c6c-a924-c35759999df8 is a project scoped user as for my understanding and can be deleted correct ?
i get forbidden deleting this User maybe because i dont have permissions or it is restricted
r
Are you logged in as an admin user?
c
yes i am logged in as an Admin .
will give it a try with a ClientApplication
@rahul1 i tried with a clientapplication (which is also an Admin) as well , i still get 401.
r
@charithv , i have gone ahead and deleted the user User/57ce21bb-f4e7-4c6c-a924-c35759999df8
c
Thank you Rahul , will ask our navigator to check if they are able to login now.
@rahul1 , confirmed user is now able to login . Thanks for all the help .
is there a way we could achieve this ? "How can we restrict specific resource type user to login using startGoogleLogin, example we want only Practitioners to login to our application which uses startGoogleLogin." maybe if there is a way create a accesspolicy for this client application so its restricted from the backend aswell .
r
Right now, we don't have a way to restrict the method of authentication via access policy. However, if you are using our react components you can hide the "email" input to only show the google auth input
176 Views