Core
API v2.x
2

getCredentialsById #

Gets credential information for the user identified by the strategy's unique user identifier userId.

The returned result object will vary depending on the strategy (see the getById() plugin function), and it can be empty.

The user identifier to use depends on the specified strategy. If you wish to get credential information using a kuid identifier, use the security:getCredentials API action instead.


Query Syntax #

HTTP #

Copied to clipboard!
URL: http://kuzzle:7512/credentials/<strategy>/<_id>/_byId
Method: GET

Other protocols #

Copied to clipboard!
{
  "controller": "security",
  "action": "getCredentialsById",
  "strategy": "<strategy>",
  "_id": "<userId>"
}

Arguments #

  • _id: user credential identifier (this is NOT the kuid)
  • strategy: authentication strategy

The provided _id is NOT the kuid but the credentials identifier. For example, with the local strategy, the credential identifier is the username field.


Response #

Returns credentials information (depend on the authentication strategy).

Example with the "local" authentication strategy: #

KuzzleRequest:

Copied to clipboard!
{
  "controller": "security",
  "action": "getCredentialsById",
  "strategy": "local",
  "_id": "johndoe@kuzzle.io"
}

Response:

Copied to clipboard!
{
  "status": 200,
  "error": null,
  "action": "getCredentialsById",
  "controller": "security",
  "result": {
    "username": "johndoe@kuzzle.io",
    "kuid": "<kuid>"
  }
}