patchRegistration not working as intended
https://github.com/FusionAuth/fusionauth-typescript-client/blob/3b272588360c8b35c9a83c9e9da8defa37632fe3/src/FusionAuthClient.ts#L2029
I was attempting to use the patchRegistration call linked above and noticed it was wiping out / overwriting registration information instead of updating an entry / adding to an array. This endpoint looks like it is actually hitting the Create a User Registration for an existing User endpoint because the application ID is not being added to the URI. To test this I made a direct http patch call through axios and it works as expected (in alignment with the documentation for this endpoint)
@shemming sorry to hear that!
We have some issues with patch support (see https://github.com/FusionAuth/fusionauth-issues/issues/441 and upvote it if it is important to you).
Can you please share sample code so we can see if this is an issue with the client library or something else?
sure!
when using the client the call looked like this:
this.faClient.patchRegistration(entry.accountId, {
registration: {
applicationId: this.applicationId,
roles: newRoles,
},
});
i had to make a call before this to get the registration info and add the additional roles to the existing roles to get newRoles. If I don't do this, the roles get overwritten and only include the newly added roles, not the existing ones.
when making the axios call it looks like this:
axios.patch(`${this.faClient.host}/api/user/registration/${entry.accountId}/${this.applicationId}`, {
registration: {
applicationId: this.applicationId,
roles: [entry.role],
}
}, {
headers: {
Authorization: this.faClient.apiKey
}
});
when doing it this way, the new role was correctly concatenated to the existing list without having to make a call to get the existing roles first.
Also running into this issue. When using patchRegistration, the user's registration roles are being wiped - even though I have not specified the roles key in the RequestRequest