SDK PHP v3.x

You are currently looking at the documentation of a previous version of Kuzzle. We strongly recommend that you use the latest version. You can also use the version selector in the top menu.

setJwtToken #

Sets the internal JWT token which will be used when making requests to Kuzzle.

If the provided token is valid, a loginAttempt event is fired with the following object:
{ success: true }

If not, the loginAttempt event is fired with the following response:
{ success: false, error: 'error message' }

setJwtToken(jwtToken) #

Arguments Type Description
jwtToken string Previously generated JSON Web Token

setJwtToken(kuzzleResponse) #

Arguments Type Description
kuzzleResponse JSON object Final Kuzzle response from a 2-steps authentication process

Return Value #

Returns the Kuzzle SDK object to allow chaining.

Usage #

Copied to clipboard!
use \Kuzzle\Kuzzle;
$kuzzle = new Kuzzle('localhost');
// Directly with a JWT Token
$kuzzle->setJwtToken('some jwt token');
  Or with a Kuzzle response.
  For instance, the final OAUTH2 response is obtained with a redirection from Kuzzle,
  and it can be provided to this method directly