[keycloak-user] Issue with Rest API "Add a social login provider to the user"

Laghuvaram, Raghu RLaghuvaram at contractor.lb.com
Fri Nov 18 00:36:15 EST 2016


Team,

I am using Rest API to create a user and add social login provider to that user. I am able to add the user but I am not able to add Social Login Provider. When I am trying to add Social Login Provider as


kc = KeycloakBuilder.builder() //
      .serverUrl("http://localhost:8080/auth") //
      .realm("SocialDemo")//
      .username("admin") //
      .password("admin") //
      .clientId("admin-cli") //
      .resteasyClient(new ResteasyClientBuilder().connectionPoolSize(10).build()) //
      .build();

response = kc.realm("SocialDemo").users().get(createdUserId).addFederatedIdentity("facebook", link);


I am getting NPE as below, Please help. Is there any other approach than what I am following?




00:27:14,145 ERROR [io.undertow.request] (default task-124) UT005023: Exception handling request to /auth/admin/realms/SocialDemo/users/87b95eea-a04c-48b2-87ce-b8e0e7eb43d8/federated-identity/facebook: org.jboss.resteasy.spi.UnhandledException: java.lang.NullPointerException

at org.jboss.resteasy.core.ExceptionHandler.handleApplicationException(ExceptionHandler.java:76)

at org.jboss.resteasy.core.ExceptionHandler.handleException(ExceptionHandler.java:212)

at org.jboss.resteasy.core.SynchronousDispatcher.writeException(SynchronousDispatcher.java:168)

at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:411)

at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:202)

at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:221)

at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)

...........

at io.undertow.server.Connectors.executeRootHandler(Connectors.java:202)

at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:793)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)

Caused by: java.lang.NullPointerException

at org.keycloak.models.jpa.JpaUserProvider.addFederatedIdentity(JpaUserProvider.java:166)

at org.keycloak.storage.UserStorageManager.addFederatedIdentity(UserStorageManager.java:158)

at org.keycloak.models.cache.infinispan.UserCacheSession.addFederatedIdentity(UserCacheSession.java:621)

at org.keycloak.models.UserFederationManager.addFederatedIdentity(UserFederationManager.java:163)

at org.keycloak.services.resources.admin.UsersResource.addFederatedIdentity(UsersResource.java:478)

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

.................

at org.jboss.resteasy.core.ResourceLocatorInvoker.invokeOnTargetObject(ResourceLocatorInvoker.java:133)

at org.jboss.resteasy.core.ResourceLocatorInvoker.invoke(ResourceLocatorInvoker.java:101)

at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:395)

... 37 more

________________________________

Notice: This communication may contain privileged and/or confidential information. If you are not the intended recipient, please notify the sender by email, and immediately delete the message and any attachments without copying or disclosing them. LB may, for any reason, intercept, access, use, and disclose any information that is communicated by or through, or which is stored on, its networks, applications, services, and devices.


More information about the keycloak-user mailing list