<div dir="ltr"><div><div>Ok, seems like some more troubleshooting payed out. <br><br></div>Seems like i missed the Accept header in the request :-)<br><br><b>Accept: application/json</b><br><br></div>The issue is now solved.<br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jun 21, 2016 at 3:45 PM, Orestis Tsakiridis <span dir="ltr"><<a href="mailto:orestis.tsakiridis@telestax.com" target="_blank">orestis.tsakiridis@telestax.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div><div><div><div><div><div>Hello,<br><br></div>I'm trying to update a keycloak Client using the client-registrations endpoint as described here:<br><br><a href="http://keycloak.github.io/docs/userguide/keycloak-server/html/client-registration.html#d4e1569" target="_blank">http://keycloak.github.io/docs/userguide/keycloak-server/html/client-registration.html#d4e1569</a><br><br></div>All seems fine and client creation as retrieval work but *update* keeps failing.<br><br></div>Here is what i do:<br><br></div>1. Create a new bearer-only Client with ClientID -> newclient<br><br></div>2. I 'Regenerate registration access token' here is what i get:<br>eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI0MGM1ZWIyNy1mYTNmLTRiNjktYjlmZC01NTIyYWM2NzYxZDkiLCJleHAiOjAsIm5iZiI6MCwiaWF0IjoxNDY2NTExNzEyLCJpc3MiOiJodHRwOi8vMTI3LjAuMC4xOjgwODEvYXV0aC9yZWFsbXMvcmVzdGNvbW0tdGVzdCIsImF1ZCI6Imh0dHA6Ly8xMjcuMC4wLjE6ODA4MS9hdXRoL3JlYWxtcy9yZXN0Y29tbS10ZXN0IiwidHlwIjoiUmVnaXN0cmF0aW9uQWNjZXNzVG9rZW4ifQ.bI2JQLOAwWdxgtaNgAXw8aliWRJRs7RviNJRPHPHyVFI6AfuBsEpZ9c5e_v6vFD0hWoNjneUnDmS-CUrzPKcBWrITXkrUwxwEQAJpQD-ONWim6AiVVOxr3sizgwxRyBX__Cny8IMm8BWjUIIIkRviSc9QE7tYscTRTE4AP5ZRlsmB7hsmfkRSgzmd5SF2ZQWj8DriSou_-ivzZ9wnlwENoewePOK1b6oZhhGQiGo4SM0pLkTWGkN8kuO3aYei6OKiol2eJn9B4bA7wr6uUruEAg03symAaDFWscpmHIl27sxF3XkYdn8F-vJwNdhFJx_t84IEKucwZEwdgNFuWZuIQ<br><br></div>3. I make the update request to:<br><br><a href="http://127.0.0.1:8081/auth/realms/restcomm-test/clients-registrations/default/newclient" target="_blank">http://127.0.0.1:8081/auth/realms/restcomm-test/clients-registrations/default/newclient</a><br><br></div><div>here is the curl command:<br> curl -i -X PUT \<br>> -H "Authorization:Bearer eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiJhNDc3NzA3Yi1hOGM4LTRjMGItYjExYi0xZWE4ZTgyNTNkYTgiLCJleHAiOjAsIm5iZiI6MCwiaWF0IjoxNDY2NTEyMDc4LCJpc3MiOiJodHRwOi8vMTI3LjAuMC4xOjgwODEvYXV0aC9yZWFsbXMvcmVzdGNvbW0tdGVzdCIsImF1ZCI6Imh0dHA6Ly8xMjcuMC4wLjE6ODA4MS9hdXRoL3JlYWxtcy9yZXN0Y29tbS10ZXN0IiwidHlwIjoiUmVnaXN0cmF0aW9uQWNjZXNzVG9rZW4ifQ.G33SBIhvFay8YAMkGxeyWMDSfeM9slS7pv49hWNxmmvaNUmUOFhP8e2-WcQJW2NZEumOKSm-UGk-2VH5EiB24F8DWn9hGVOlJdIysewbyei94Xqcu-xoOAhSRdcU3xOEEKrVBQxTAQRWahp5Jil1A_jHoY1bLcQk1Keu1WAOKDBgUyGu2pO7sfs1hjUHQ2V_pC9xOeC7rf3rpdXF7OAb9Xf8pD1_xfuUwMSGJzey0Mqs3dp9qS_v4g6CaOQvcMOVgf0_cb0RKkeSyqgxcTO0Laxrz7NNP4I9ZojLQE_8bEyPQyrREfWZj8zQp4hLO89k_O_xzv3iOYOj064xiEX6nA" \<br>> -H "Content-Type:application/json" \<br>> -d \<br>> '{"clientId":"newclient","enabled":false}<br>> ' \<br>> '<a href="http://127.0.0.1:8081/auth/realms/restcomm-test/clients-registrations/default/newclient" target="_blank">http://127.0.0.1:8081/auth/realms/restcomm-test/clients-registrations/default/newclient</a>'<br><br></div><div>4. I get a 500 Internal Server error response with the following error in the logs:<br><br><div style="margin-left:40px">RESTEASY002005: Failed executing PUT /realms/restcomm-test/clients-registrations/default/newclient: org.jboss.resteasy.core.NoMessageBodyWriterFoundFailure: Could not find MessageBodyWriter for response object of type: org.keycloak.representations.idm.ClientRepresentation of media type: application/octet-stream<br></div><br></div><div>5. If i run again i get a 401 so it seems that authorization passes the first time but something breaks afterwards. Next time, the one-time token is already consumed so i get a 401. Ok, that makes sense.<br></div><div><br></div><div>As you may have noticed i'm using a pretty reduced version of the ClientRepresentation but i've also experienced with others that are more or less complete and also by sending the <b>exact json response as returned when retrieving the client</b>. Same result :-(<br><br></div><div>Also, the rest of the HTTP methods (POST on /default,DELETE, GET) work fine with the registration access token. So it seems that either i'm sending crap or sth else happens.<br><br></div><div>Any ideas what may be wrong? <br><br></div><div>Thanks<br></div></div></div>
</blockquote></div><br></div></div>