keycloak executeActionsEmail method call throws HTTP 400 Bad Request with redirectURI

Viewed 906

There is HTTP 400 Bad Request when calling executeActionsEmail with parameter clientId, redirectUri and actions but working fine with actions parameter and actions,lifespan.

UserRepresentation userrep = getUserRepresentation(email);
String userId = userrep.getId();
UserResource urs = usersRessource.get(userId);
urs.executeActionsEmail(Arrays.asList("UPDATE_PASSWORD", "VERIFY_EMAIL", "UPDATE_PROFILE"));

Above code is working fine, but when I am passing parameter clientId,redirectUri and actions it is throwing exception.

UserRepresentation userrep = getUserRepresentation(email);
String userId = userrep.getId();
UserResource urs = usersRessource.get(userId);
urs.executeActionsEmail("myclientid","http://localhost:8080/team/",Arrays.asList("UPDATE_PASSWORD", "VERIFY_EMAIL", "UPDATE_PROFILE"));

Above code throws exception

javax.ws.rs.BadRequestException: HTTP 400 Bad Request
at org.jboss.resteasy.client.jaxrs.internal.ClientInvocation.handleErrorStatus(ClientInvocation.java:219) ~[resteasy-client-3.9.1.Final.jar:3.9.1.Final]
at org.jboss.resteasy.client.jaxrs.internal.proxy.extractors.DefaultEntityExtractorFactory$3.extractEntity(DefaultEntityExtractorFactory.java:50) ~[resteasy-client-3.9.1.Final.jar:3.9.1.Final]
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invokeSync(ClientInvoker.java:151) ~[resteasy-client-3.9.1.Final.jar:3.9.1.Final]
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientInvoker.invoke(ClientInvoker.java:112) ~[resteasy-client-3.9.1.Final.jar:3.9.1.Final]
at org.jboss.resteasy.client.jaxrs.internal.proxy.ClientProxy.invoke(ClientProxy.java:76) ~[resteasy-client-3.9.1.Final.jar:3.9.1.Final]
at com.sun.proxy.$Proxy173.executeActionsEmail(Unknown Source) ~[na:na]

Spring boot

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.1.7.RELEASE</version>
</parent>

keycloak-admin-client

<dependency>
        <groupId>org.keycloak</groupId>
        <artifactId>keycloak-admin-client</artifactId>
        <version>10.0.1</version>
    </dependency>

Is there something wrong with 2nd fraction of code? In below the question exception were there for all the scenario but in my case exception throws when I am passing clientId and redirectUri.

Keycloak Java admin client returns 400 Error on triggering verification email

Any help would be very helpful!

0 Answers
Related