Groups keyboard shortcuts have been updated
Dismiss
See shortcuts

Custom Restful Admin APIs not working

59 views
Skip to first unread message

Naresh Manthena

unread,
Sep 3, 2024, 12:54:28 AM9/3/24
to Keycloak Dev, Keycloak User
Hello All,

Anyone developed custom admin Restful APIs including authorization, I went through the example and doc but its not working getting below error.

{
"error": "HTTP 405 Method Not Allowed",
"error_description": "For more on this error consult the server log at the debug level."
} 

If anyone develops it, please share the references.


--
Regards,
Naresh Manthena,
M: 9000994443.

Naresh Manthena

unread,
Sep 4, 2024, 12:10:18 AM9/4/24
to Keycloak Dev, Keycloak User
Anyone has anything on this?


Regards,
Naresh Manthena,
M: 9000994443.

Zakaria A.

unread,
Sep 4, 2024, 5:19:39 AM9/4/24
to Keycloak Dev

Hello, 

I think it's better to use the keycloak discourse group: https://keycloak.discourse.group/ for this sort of inquiries. You probably need to annotate your resource class with @jakarta.ws.rs.ext.Provider or add an empty beans.xml file under the folder META-INF, here is the reference from the docs: https://www.keycloak.org/docs/25.0.2/upgrading/#upgrading-your-custom-jax-rs-resources


I hope that helps.

Zakaria

Naresh Manthena

unread,
Sep 5, 2024, 12:35:58 AM9/5/24
to Zakaria A., Keycloak Dev
Hello Zakaria,

I have done the same thing. Kindly look at this repo https://github.com/nmanthena18/keycloakRESTspi
let me know if I made any mistakes here.

--
You received this message because you are subscribed to the Google Groups "Keycloak Dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email to keycloak-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/keycloak-dev/4d5e5518-2433-4bd1-83f2-6fe3cdcf0173n%40googlegroups.com.

Zakaria A.

unread,
Sep 7, 2024, 12:27:03 PM9/7/24
to Keycloak Dev
You can find a working example here: https://github.com/zak905/keycloak-api-key-demo

I made some changes to your example to make it work: https://github.com/nmanthena18/keycloakRESTspi/pull/1

Basically you should not annotate your resource class with @Path. 

I hope that helps. 

Naresh Manthena

unread,
Sep 7, 2024, 11:30:47 PM9/7/24
to Zakaria A., Keycloak Dev
Thanks Zakaria,

This is very helpful, 
But one note here, I want to secure these api's with a service-account same as admin apis. and I went through your example. We need to pass our own x-api-key instead of.

Zakaria A.

unread,
Sep 8, 2024, 1:14:23 PM9/8/24
to Keycloak Dev
In this case, you probably need to secure the endpoint using the Keycloak token and not an api key. Here is a working example: https://github.com/zak905/extending-keycloak-udemy-course/blob/lesson9/src/main/java/com/gwidgets/EmailExistsResourceProvider.java#L41

Cheers, 
Zakaria

Sridhara Nayak

unread,
Dec 12, 2024, 2:36:47 AM12/12/24
to Keycloak Dev
u can create custom admin rest api 
Reply all
Reply to author
Forward
0 new messages