updateCredentials

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

});

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

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

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

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

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

Callback response

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

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


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

ArgumentsTypeDescription
strategystringStrategy you want to create credentials in
kuidJSON objectUser'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 updated credentials.