Issue with Users Signed Up as Both Patient and Pra...
# support
c
Hi @rahul1 , We’re encountering a strange issue with some users who initially signed up to our app as Patients and were later invited as Practitioners using the same email address. Whenever these users attempt to log in, only their Patient profile is fetched. Following the documentation on how to remove a user (link), we used the "remove user" option for their Patient user resource. However, the app then shows "user not found." We also tried removing the Practitioner user and re-inviting them as Practitioners, but the issue persists. Unless we re-invite them as Patients, they are unable to log in to the app. To debug, I reproduced the issue by inviting a user as both Patient and Practitioner using the same email address and have provided some additional details below that might help in reproducing the problem. Let us know if we are missing something or if you need more information from us. P.S.: We later added constraints on our end to prevent the same email from being used for both Patient and Practitioner profiles. However, we would like to understand how to enable these affected users to log in as Practitioners again. Looking forward to your insights!
Details on how i tried to reproduce the issue.
Copy code
email: [user]+testuser@domain.health
    Practitioner: https://app.medplum.com/Practitioner/4fe7dd88-6424-42b6-9963-a02d78d2818f
        memebership: https://app.medplum.com/ProjectMembership/58d049b7-3eac-4547-a632-da240636fce5
        user: https://app.medplum.com/User/3b84b479-fe91-462d-805f-62c160212027 (not found)

    Patient: https://app.medplum.com/Patient/97fe3e61-29fc-4e47-9b05-ad67ad632580
        membership: https://app.medplum.com/ProjectMembership/cb7f4cf6-efff-4b78-abf4-9bbd3886c896
        user: https://app.medplum.com/User/cfec41e6-8813-4f3d-bca6-59d4a1448611

    [user]+testuser@domain.health logs me in as Practitioner 
    * remove user from https://app.medplum.com/admin/users (removed the practitioner user) -> trying to login says user not found even when a user exists with same email under https://app.medplum.com/admin/patients (https://app.medplum.com/admin/members/cb7f4cf6-efff-4b78-abf4-9bbd3886c896) 
    * also 'remove user' the patient and reinvited the the same email  as patient 
        Membership: https://app.medplum.com/ProjectMembership/d0cfe335-c0f1-4627-ae67-f386dd1e9696
        Patient: https://app.medplum.com/Patient/97fe3e61-29fc-4e47-9b05-ad67ad632580 -> points to old patient 
        user: https://app.medplum.com/User/cfec41e6-8813-4f3d-bca6-59d4a1448611 -> points to old resource 
    * did reset password and try to login says user not found -> expect it to login me in as a patient 
    ** reinivted the same email as practitioner 
        Project Membership: https://app.medplum.com/ProjectMembership/f1edceb5-487b-4e8f-9005-fa447067d3a5
        Practitioner: https://app.medplum.com/Practitioner/4fe7dd88-6424-42b6-9963-a02d78d2818f -> points to old practitioner 
        User: https://app.medplum.com/User/3b84b479-fe91-462d-805f-62c160212027 -> Not found  (points to old resource )
    ** now login works and logs me in as a practitioner .
184 Views