Closed egdelwonk closed 1 year ago
Ok, sorry for the false report. It turns out that I was making the invitation from the admin user that was on my master
realm (which works in the UI btw), but I needed to make the invitation from a user that had the appropriate access on my myrealm
realm. I'm guessing that's why the UserModel wasn unable to resolve.
Hi @xgp!
When fetching organization invitations, I'm receiving an HTTP 400 error from the endpoint.
It appears that if you add an invitation from the Admin UI. E.g. http://localhost:8080/auth/admin/master/console/#/myrealm/organizations/{orgId}/invitations that the response from the REST endpoint is an error.
I noticed this in the debug logs:
2023-06-15 18:49:26,472 DEBUG [org.keycloak.services.error.KeycloakErrorHandler] (executor-thread-3) Error response 400: com.fasterxml.jackson.databind.JsonMappingException: Cannot invoke "org.keycloak.models.UserModel.getId()" because the return value of "io.phasetwo.service.model.InvitationModel.getInviter()" is null
If I remove the pending invitation and fetch the endpoint again, it returns an empty array without an error as expected.
What's odd, is that inspecting the XHR request on the admin page to /invitations (http://localhost:8080/auth/realms/myrealm/orgs/{orgId}/invitations) the inviterId is present on the data returned.
e.g.
I think the issue could be that the user does not exist yet. (# Edit, just tested this, added the user before inviting and seeing the same error log.)