By: Bahador Raha user 01 Nov 2017 at 6:13 p.m. CDT

6 Responses
Bahador Raha gravatar
Hi, I tried to dynamically register a client using opneid-implicit-client sample SPA. My request seems to be valid bit I received error invalid_client_metadata with http status code **500** (Internal Server Error)! I did not alter its code and just commented the client_id field in the index.html to enable dynamic client registration. This is the POST request header and body: **Header:** ``` Host: my-idp.com Accept: application/json Accept-Language: en-US,en;q=0.5 Content-Type: application/json Content-Length: 267 Connection: keep-alive Pragma: no-cache Cache-Control: no-cache ``` **Body:** ``` { "redirect_uris":["https://localhost:8443/jsapp/login-callback.html"], "application_type":"web", "client_name":"Dynamically Registered Client", "subject_type":"public", "grant_types":["implicit"], "response_types":["token","id_token"] "scopes":["email","openid","profile"] } ``` Unfortunately I could not found any related log records. Thanks in advance.

By Michael Schwartz Account Admin 01 Nov 2017 at 11:27 p.m. CDT

Michael Schwartz gravatar
``` application_type":"web" ``` Try `native`

By Bahador Raha user 04 Nov 2017 at 2:06 a.m. CDT

Bahador Raha gravatar
Thanks for your reply but unfortunately it didn't help. I also tested POSTing the request with empty body, which I expected a http status code 400 but I received 500 (Internal server error) again! (When I send a simple **GET** request to this endpoint, I receive status code 400, and always status code 500 for **POST** requests) p.s. I didn't change any default sever configuration related to dynamic client registration.

By Michael Schwartz Account Admin 05 Nov 2017 at 3:51 a.m. CST

Michael Schwartz gravatar
Apache logs? Oxauth logs? Also please include your updated request

By Bahador Raha user 06 Nov 2017 at 5:02 a.m. CST

Bahador Raha gravatar
**oxauth.log**: ``` 2017-11-06 11:02:45,231 ERROR [qtp2008017533-19] [xdi.oxauth.register.ws.rs.RegisterRestWebServiceImpl] (RegisterRestWebServiceImpl.java:231) - A JSONObject text must begin with '{' at character 0 of org.codehaus.jettison.json.JSONException: A JSONObject text must begin with '{' at character 0 of at org.codehaus.jettison.json.JSONTokener.syntaxError(JSONTokener.java:463) ~[jettison-1.3.2.jar:1.3.2] at org.codehaus.jettison.json.JSONObject.<init>(JSONObject.java:173) ~[jettison-1.3.2.jar:1.3.2] at org.codehaus.jettison.json.JSONObject.<init>(JSONObject.java:280) ~[jettison-1.3.2.jar:1.3.2] at org.xdi.oxauth.client.RegisterRequest.fromJson(RegisterRequest.java:978) ~[oxauth-client-3.1.0.Final.jar:?] at org.xdi.oxauth.register.ws.rs.RegisterRestWebServiceImpl.registerClientImpl(RegisterRestWebServiceImpl.java:113) [classes/:?] at org.xdi.oxauth.register.ws.rs.RegisterRestWebServiceImpl.requestRegister(RegisterRestWebServiceImpl.java:102) [classes/:?] at org.xdi.oxauth.register.ws.rs.RegisterRestWebServiceImpl$Proxy$_$$_WeldClientProxy.requestRegister(Unknown Source) [classes/:?] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_112] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_112] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_112] at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_112] at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:140) [resteasy-jaxrs-3.0.21.Final.jar:3.0.21.Final] at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:295) [resteasy-jaxrs-3.0.21.Final.jar:3.0.21.Final] at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:249) [resteasy-jaxrs-3.0.21.Final.jar:3.0.21.Final] at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:236) [resteasy-jaxrs-3.0.21.Final.jar:3.0.21.Final] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:402) [resteasy-jaxrs-3.0.21.Final.jar:3.0.21.Final] at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:209) [resteasy-jaxrs-3.0.21.Final.jar:3.0.21.Final] at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:228) [resteasy-jaxrs-3.0.21.Final.jar:3.0.21.Final] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56) [resteasy-jaxrs-3.0.21.Final.jar:3.0.21.Final] at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51) [resteasy-jaxrs-3.0.21.Final.jar:3.0.21.Final] at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [servlet-api-3.1.jar:3.1.0] at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:845) [jetty-servlet-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1772) [jetty-servlet-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.websocket.server.WebSocketUpgradeFilter.doFilter(WebSocketUpgradeFilter.java:193) [websocket-server-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) [jetty-servlet-9.3.15.v20161220.jar:9.3.15.v20161220] at org.ocpsoft.rewrite.servlet.RewriteFilter.doFilter(RewriteFilter.java:226) [rewrite-servlet-3.4.1.Final.jar:3.4.1.Final] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) [jetty-servlet-9.3.15.v20161220.jar:9.3.15.v20161220] at org.gluu.oxserver.filters.AbstractCorsFilter.handleSimpleCORS(AbstractCorsFilter.java:212) [oxcore-server-3.1.0.Final.jar:?] at org.gluu.oxserver.filters.AbstractCorsFilter.doFilter(AbstractCorsFilter.java:112) [oxcore-server-3.1.0.Final.jar:?] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1759) [jetty-servlet-9.3.15.v20161220.jar:9.3.15.v20161220] at org.xdi.oxauth.audit.debug.ServletLoggingFilter.doFilter(ServletLoggingFilter.java:73) [classes/:?] at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1751) [jetty-servlet-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:582) [jetty-servlet-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:143) [jetty-server-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:548) [jetty-security-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:226) [jetty-server-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1180) [jetty-server-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:512) [jetty-servlet-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185) [jetty-server-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1112) [jetty-server-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) [jetty-server-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:213) [jetty-server-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:119) [jetty-server-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:134) [jetty-server-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.server.Server.handle(Server.java:534) [jetty-server-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:320) [jetty-server-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [jetty-server-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:283) [jetty-io-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:110) [jetty-io-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:93) [jetty-io-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.executeProduceConsume(ExecuteProduceConsume.java:303) [jetty-util-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceConsume(ExecuteProduceConsume.java:148) [jetty-util-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:136) [jetty-util-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:671) [jetty-util-9.3.15.v20161220.jar:9.3.15.v20161220] at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:589) [jetty-util-9.3.15.v20161220.jar:9.3.15.v20161220] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_112] ``` and my **Request**: **Header**: ``` Host: my-idp.com User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0 Accept: application/json Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate, br Referer: http://127.0.0.1:8080/jsapp/ Content-Type: application/json Content-Length: 263 Origin: http://127.0.0.1:8080 Connection: keep-alive Cache-Control: max-age=0, no-cache Pragma: no-cache ``` **Body**: ``` {"redirect_uris":["https://localhost:8443/jsapp/login-callback.html"],"application_type":"native","client_name":"Dynamically Registered Client","subject_type":"public","grant_types":["implicit"],"response_types":["token","id_token"],"scopes":["email","openid","profile"]} ``` It seems there is a problem with my JSON object format but it looks OK. **UPDATE**: I tested requesting dynamic client registration with another client web application and again the same Status Code 500 and the same error in oxauth.log (JSONException).

By Aliaksandr Samuseu staff 08 Nov 2017 at 11:38 a.m. CST

Aliaksandr Samuseu gravatar
Hi, Bahador. Next request, produced from the latest request your shared, worked as expected for me: ``` POST /oxauth/restv1/register HTTP/1.1 Host: clstr-ce302.host.loc User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:56.0) Gecko/20100101 Firefox/56.0 Accept: application/json Accept-Language: en-US,en;q=0.5 Accept-Encoding: gzip, deflate, br Referer: http://127.0.0.1:8080/jsapp/ Content-Type: application/json Content-Length: 273 Origin: http://127.0.0.1:8080 Connection: keep-alive Cache-Control: max-age=0, no-cache Pragma: no-cache {"redirect_uris":["https://localhost:8443/jsapp/login-callback.html"],"application_type":"native","client_name":"Dynamically Registered Client","subject_type":"public","grant_types":["implicit"],"response_types":["token","id_token"],"scopes":["email","openid","profile"]} ``` Everything is left mostly unchanged, except for the directives I had to change to run it against my own instance. The client is created successfully. Could you perhaps re-test it in 3.1.1 package, if possible? **Update:** By the way, also works for me in case `"application_type":"web"` is used.

By Bahador Raha user 12 Nov 2017 at 1:54 a.m. CST

Bahador Raha gravatar
Thanks for your help. Upgrading from 3.1.0 to 3.1.1 according to this [link](https://gluu.org/docs/ce/upgrade/#upgrade-from-310-to-311) did not resolve the problem. so I removed 3.1.0 and installed 3.1.1 package and it worked nice!