Hello I hope you can help.
When I want to create my user I do follows
Keycloak keycloak = Keycloak.getInstance (getURL (), "MyRealm", "myUser", "myPassword" clientID);
UserRepresentation userRep = new UserRepresentation ();
userRep.setUsername ("testUser");
CredentialRepresentation CredentialRepresentation credentials = new ();
credentials.setType ("password");
credentials.setValue ("t");
List <CredentialRepresentation> list = new ArrayList ();
list.add (credentials);
userRep.setCredentials (list);
userRep.setEnabled (true);
userRep.setEmailVerified (false);
userRep.setFirstName ("Javier");
userRep.setLastName ("Javi");
Map map = new HashMap ();
userRep.setAttributes (map);
UsersResource users = keycloak.realm ("MyRealm") users ().;
Response response = users.create (userRep);
first responds with code 200
- 18:14:09 DEBUG org.apache.http.headers:273
>> POST /auth/realms/prevvy/protocol/openid-connect/token HTTP/1.1
- 18:14:09 DEBUG org.apache.http.impl.conn.DefaultClientConnection:254
Receiving response: HTTP/1.1 200 OK
but at the end responds with a 500 error and I don't know why :(:
- 18:14:10 DEBUG org.apache.http.wire:63
>> "Host: develop.prevvy.co:9095[\r][\n]"
- 18:14:10 DEBUG org.apache.http.wire:63
>> "Connection: Keep-Alive[\r][\n]"
- 18:14:10 DEBUG org.apache.http.wire:63
>> "[\r][\n]"
- 18:14:10 DEBUG org.apache.http.headers:273
>> POST /auth/admin/realms/prevvy/users HTTP/1.1
- 18:14:10 DEBUG org.apache.http.headers:276
>> Accept-Encoding: gzip, deflate
- 18:14:10 DEBUG org.apache.http.headers:276
>> Authorization: Bearer eyJhbGciOiJSUzI1NiJ9.eyJqdGkiOiI3ODgzZmE5ZS1iYzkyLTQzNDQtOWY3Ni02NTdiYWI4YjAzNzkiLCJleHAiOjE0MzY0OTEyMzYsIm5iZiI6MCwiaWF0IjoxNDM2NDkwOTM2LCJpc3MiOiJodHRwOi8vZGV2ZWxvcC5wcmV2dnkuY286OTA5NS9hdXRoL3JlYWxtcy9wcmV2dnkiLCJhdWQiOiJldmVudGhhbmRsZXItY2xpZW50Iiwic3ViIjoiYmIyMDQyZDktNjhlMS00MjQ5LWE5YWQtZTMzZjFkMTA3MGQ4IiwiYXpwIjoiZXZlbnRoYW5kbGVyLWNsaWVudCIsInNlc3Npb25fc3RhdGUiOiI0MzZjMTI2Ny1mNzA5LTQwNTEtOTk0YS03OWYyNjExZjM2Y2EiLCJjbGllbnRfc2Vzc2lvbiI6IjkxOGI2NWQ4LTY1YTUtNDljNi04M2JiLWQzOTg4ZGU0ODVlMCIsImFsbG93ZWQtb3JpZ2lucyI6W10sInJlYWxtX2FjY2VzcyI6eyJyb2xlcyI6WyJtYW5hZ2UtdXNlcnMiXX0sInJlc291cmNlX2FjY2VzcyI6e319.hAfHcOZZJwYBBoTRhlqzPfraesg7n9Gp0IHFQvmLYK-wYQBcFb7XAkAdGNWujW4kh5e7EJmyIggLWn0KnaPq2Qf2f57x34A3wjSklxdlIskUjLRZMVjUmUz65ayCPaFh33rxQIv6mhtST6CPdowZdsRyGfmcE9kKhknU8jjY2tY
- 18:14:10 DEBUG org.apache.http.headers:276
>> Content-Type: application/json
- 18:14:10 DEBUG org.apache.http.headers:276
>> Content-Length: 498
- 18:14:10 DEBUG org.apache.http.headers:276
- 18:14:10 DEBUG org.apache.http.headers:276
>> Connection: Keep-Alive
- 18:14:10 DEBUG org.apache.http.wire:77
>> "{"self":null,"id":null,"username":"testttt","enabled":true,"totp":false,"emailVerified":false,"firstName":"Javier","lastName":"Coria","email":"
jcoria@healthcentrix.com","federationLink":null,"attributes":{},"credentials":[{"type":"password","device":null,"value":"t","hashedSaltedValue":null,"salt":null,"hashIterations":null,"temporary":false}],"requiredActions":null,"federatedIdentities":null,"realmRoles":null,"clientRoles":null,"clientConsents":null,"applicationRoles":null,"socialLinks":null}"
- 18:14:10 DEBUG org.apache.http.wire:63
<< "HTTP/1.1 500 Internal Server Error[\r][\n]"
Thank you!!