-
Notifications
You must be signed in to change notification settings - Fork 6
Open
Description
When trying to replicate the following, in my app, using hosted Aidbox,
examples/orgbac-practitioner-application/app/api/auth/register/route.ts
Lines 181 to 196 in 89b3ee8
| // Step 7: Create User using organization-based API | |
| const userResponse = await fetch(`${AIDBOX_URL}/Organization/${organization.id}/fhir/User`, { | |
| method: 'POST', | |
| headers: { | |
| 'Authorization': `Bearer ${orgToken}`, | |
| 'Content-Type': 'application/json' | |
| }, | |
| body: JSON.stringify({ | |
| resourceType: 'User', | |
| email, | |
| password, // Aidbox will hash this | |
| fhirUser: { | |
| reference: `PractitionerRole/${practitionerRole.id}` | |
| } | |
| }) | |
| }) |
I get a 422 response. At the bottom, I'll give a full request/response example.
I am also including sub, based on the token introspection documentation, in the hope that this will cause requests made via my JWT (with sub claim) will be associated with the user.
Request:
POST https://yckpelctdh.aidbox.app/Organization/e:staging-i:solo-u:1646602/fhir/User
{
"id": "e:staging-u:1646602",
"sub": "e:staging-u:1646602",
"name": "Tim Cieplowski",
"email": "tim.cieplowski@doxy.me",
"fhirUser": {
"reference": "PractitionerRole/e:staging-u:1646602--e:staging-i:solo-u:1646602"
}
}
Response:
{
"resourceType": "OperationOutcome",
"text": {
"status": "generated",
"div": "Invalid resource"
},
"issue": [
{
"severity": "fatal",
"code": "invalid",
"expression": [
"User.sub"
],
"details": {
"coding": [
{
"system": "http://aidbox.app/CodeSystem/operation-outcome-type",
"code": "unknown-key"
}
]
},
"diagnostics": "Unrecognized property 'sub'"
},
{
"severity": "fatal",
"code": "invalid",
"expression": [
"User.name"
],
"details": {
"coding": [
{
"system": "http://aidbox.app/CodeSystem/operation-outcome-type",
"code": "invalid-type"
},
{
"system": "http://aidbox.app/CodeSystem/schema-id",
"code": "User"
}
]
},
"diagnostics": "Invalid type for the field. Expected 'BackboneElement', but got 'string'"
},
{
"severity": "fatal",
"code": "invalid",
"expression": [
"User.fhirUser"
],
"details": {
"coding": [
{
"system": "http://aidbox.app/CodeSystem/operation-outcome-type",
"code": "invalid-target-profile"
}
]
},
"diagnostics": "Referenced resource PractitionerRole/e:staging-u:1646602--e:staging-i:solo-u:1646602 content doesn't conform to any of target profiles: http://hl7.org/fhir/StructureDefinition/Practitioner,http://hl7.org/fhir/StructureDefinition/Person,http://hl7.org/fhir/StructureDefinition/Patient"
}
]
}
Metadata
Metadata
Assignees
Labels
No labels