<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:"Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"\@Yu Gothic";
        panose-1:2 11 4 0 0 0 0 0 0 0;}
@font-face
        {font-family:inherit;
        panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.crayon-e
        {mso-style-name:crayon-e;}
span.crayon-v
        {mso-style-name:crayon-v;}
span.crayon-h
        {mso-style-name:crayon-h;}
span.crayon-o
        {mso-style-name:crayon-o;}
span.crayon-r
        {mso-style-name:crayon-r;}
span.crayon-sy
        {mso-style-name:crayon-sy;}
span.crayon-s
        {mso-style-name:crayon-s;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="DE-AT" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span lang="EN-CA">Hi userlist,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">I&#8217;m attempting to create a user in java in the way described here, from a java application and using the keycloak standalone server<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><a href="http://www.first8.nl/blog/programmatically-adding-users-in-keycloak/">http://www.first8.nl/blog/programmatically-adding-users-in-keycloak/</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Specifically <o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal" style="line-height:11.25pt"><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;inherit&quot;,serif;color:black">CredentialRepresentation credential = new CredentialRepresentation();</span><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:11.25pt"><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;inherit&quot;,serif;color:black">credential.setType(CredentialRepresentation.PASSWORD);</span><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:11.25pt"><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;inherit&quot;,serif;color:black">credential.setValue(&quot;test123&quot;);</span><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:11.25pt"><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;inherit&quot;,serif;color:black">UserRepresentation user = new UserRepresentation();</span><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:11.25pt"><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;inherit&quot;,serif;color:black">user.setUsername(&quot;testuser&quot;);</span><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:11.25pt"><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;inherit&quot;,serif;color:black">user.setFirstName(&quot;Test&quot;);</span><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:11.25pt"><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;inherit&quot;,serif;color:black">user.setLastName(&quot;User&quot;);</span><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:11.25pt"><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;inherit&quot;,serif;color:black">user.setCredentials(Arrays.asList(credential));</span><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p></o:p></span></p>
<p class="MsoNormal" style="line-height:11.25pt"><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;inherit&quot;,serif;color:black">kc.realm(&quot;master&quot;).users().create(user);</span><span lang="EN-CA" style="font-size:9.0pt;font-family:&quot;Courier New&quot;;color:black"><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">The user is created correctly no errors either java side or in the output from the standalone server and all data seems to be correct however when attempting to login with the user the credentials are incorrect. I&#8217;ve
 tried changing the password manually on the keycloak server and the login is then possible. Am I missing something or is this a bug?<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Thanks,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA"><o:p>&nbsp;</o:p></span></p>
<p class="MsoNormal"><span lang="EN-CA">Will<o:p></o:p></span></p>
</div>
</body>
</html>