Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

patchRegistration not working as intended #72

Open
shemming opened this issue Feb 22, 2022 · 3 comments
Open

patchRegistration not working as intended #72

shemming opened this issue Feb 22, 2022 · 3 comments

Comments

@shemming
Copy link

patchRegistration(userId: UUID, request: RegistrationRequest): Promise<ClientResponse<RegistrationResponse>> {

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)

@mooreds
Copy link
Contributor

mooreds commented Feb 24, 2022

@shemming sorry to hear that!

We have some issues with patch support (see FusionAuth/fusionauth-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?

@shemming
Copy link
Author

shemming commented Feb 24, 2022

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.

@pharapeti
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants