p2-inc / keycloak-orgs

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

500 error when calling endpoint #3

Closed fgarioli closed 2 years ago

fgarioli commented 2 years ago

I’m trying to generate the jar file from the source, but I’m facing some difficult things. I had to install keycloak from source to get some missing dependencies, so after that I could compile and generate the jar file. The problem is when I put the jar on my keycloak test instance, and call some endpoint related to the library. The response status is 500. I look at keycloak log to see what happened and it asks for some dependencies. So, it seems like the library compilation process it was no ok on maven. Could you help me please?

The log file is attached to the issue. If you need any other information, just let me know.

Thanks!

keycloak.log

xfh commented 2 years ago

I've made the same experience :-)

I managed to get it fixed by adding the Keycloak Admin Client JAR to the providers. The REST API Resources are making use of the admin client to call other Keycloak REST APIs.

xfh commented 2 years ago

BTW. somehow the URLs are exposed differently that the default REST APIs. I didn't manage to get it work with e.g. kcadm.sh get orgs -r myrealm. Keycloak 18.0.0 adds an admin/ path, where as this extension is binding directly to the root.

Here an example: curl -H "Authorization: Bearer ${token}" http://localhost:8080/realms/myreal/orgs

fgarioli commented 2 years ago

Keycloak Admin Client

Thanks! It works now!

xgp commented 2 years ago

@fgarioli Sorry I missed this one. Yes, you need the admin client jar to run this. I'll add it to the docs.

xgp commented 2 years ago

Added to README in f12ce36