p2-inc / keycloak-orgs

Single realm, multi-tenancy for SaaS apps
https://phasetwo.io
Other
389 stars 66 forks source link

Create new organization API doesn't accept request body #18

Closed lerryklitzke closed 1 year ago

lerryklitzke commented 1 year ago

I have an issue about "create a new organization" API. I am following the documentation https://phasetwo.io/api/create-a-new-organization/

I'm using the docker image available in https://quay.io/repository/phasetwo/phasetwo-keycloak?tab=tags&tag=19.0.3-alpha

In the request I sent a body with the same structure exemplified in the docs and got error 500 as response. To get the token I am using the credentials of a user with all existent roles (including realm-management create-organization).

Looking into the container logs I saw the following: "Uncaught server error: com.fasterxml.jackson.databind.exc.MismatchedInputException: Cannot deserialize value of type java.util.LinkedHashMap<java.lang.String,java.util.List<java.lang.String>> from Array value (token JsonToken.START_ARRAY) at [Source: (io.quarkus.vertx.http.runtime.VertxInputStream); line: 10, column: 17] (through reference chain: io.phasetwo.service.representation.Organization["attributes"])"

It seems that the validation isn't accepting my body. I tried all possible variations in attributes property but nothing worked. Any ideas why is it happening?

xgp commented 1 year ago

@lerryklitzke Can you show your request so I can try to reproduce?

lerryklitzke commented 1 year ago

@xgp the request doesn't work when you use localhost. Why this? It worked when I used 127.0.0.1

xgp commented 1 year ago

Are you using a different host to get the token and make an API request? They must be the same.

Can you show the requests you are using? I can’t help you debug without them.

On Sat, Oct 15, 2022, at 12:13 AM, Lerry Klitzke wrote:

@xgp https://github.com/xgp the request doesn't work when you use localhost. Why this? It worked when I used 127.0.0.1

— Reply to this email directly, view it on GitHub https://github.com/p2-inc/keycloak-orgs/issues/18#issuecomment-1279523502, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAB3UHMG6UFVVKT2CK23V6DWDHLKLANCNFSM6AAAAAARFM66VA. You are receiving this because you were mentioned.Message ID: @.***>