createCredentials

// Using callbacks (node.js or browser)
kuzzle.security.createCredentials('local', 'kuid', {'username': 'foo'}, function (error, credentials) {

});

// Using promises (node.js)
kuzzle
  .security
  .createCredentialsPromise('local', 'kuid', {'username': 'foo'})
  .then(credentials => {

  });
JSONObject credentials = new JSONObject().put("username", "bar");

kuzzle.security.createCredentials("local", "kuid", credentials, new ResponseListener<JSONObject>() {
  @Override
  public void onSuccess(JSONObject credentials) {

  }

  @Override
  public void onError(JSONObject error) {
    // Handle error
  }
}
<?php
use \Kuzzle\Kuzzle;

$kuzzle = new Kuzzle('localhost');
$credentials = $kuzzle->security->createCredentials('local', 'kuid', ['username' => 'foo']);

Callback response

{
  "username": "foo",
  "kuid": "<Kuzzle Unique Identifier>"
}

Create credentials of the specifiedfor the user.


createCredentials(strategy, kuid, credentials, [options], [callback])

ArgumentsTypeDescription
strategystringStrategy you want to create credentials in
kuidstringUser's kuid
credentialsJSON objectThe credentials
optionsJSON objectOptional parameters
callbackfunctionOptional callback handling the response

Options

OptionTypeDescriptionDefault
queuablebooleanMark this request as (not) queuabletrue

Callback response

The response is a an object reflecting the created credentials.