// Using callbacks (node.js or browser)
kuzzle.createMyCredentials('local', {'username': 'foo'}, function (err, res) {
  console.log(res);     // {username: 'bar', kuid: '<kuid>'}

// Using promises (node.js)
  .createMyCredentials('local', {'username': 'foo'})
  .then(res => {
    console.log(res);   // {username: 'foo', kuid: '<kuid>'}
JSONObject credentials = new JSONObject().put("username", "bar");

kuzzle.createMyCredentials("local", credentials, new ResponseListener<JSONObject>() {
  public void onSuccess(JSONObject result) {
    // result var contains the new credentials and the kuid of the user

  public void onError(JSONObject error) {
    // Handle error
use \Kuzzle\Kuzzle;

$kuzzle = new Kuzzle('localhost');
$result = $kuzzle->createMyCredentials('local', ['username' => 'foo']);

// $result = [username => 'foo', kuid => '<kuid>']

Create credentials of the specifiedfor the current user. The credentials to send depends entirely on the authentication plugin and strategy you want to create credentials for.

createMyCredentials(strategy, credentials, [options], [callback])

strategystringStrategy you want to create credentials in
credentialsJSON objectThe credentials
optionsJSON objectOptional parameters
callbackfunctionOptional callback handling the response


queuablebooleanMark this request as (not) queuabletrue

Callback response

The response is a an object reflecting the created credentials.