SDK
SDK PHP v3.x
1

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) #

ArgumentsTypeDescription
jwtTokenstringPreviously generated JSON Web Token

setJwtToken(kuzzleResponse) #

ArgumentsTypeDescription
kuzzleResponseJSON objectFinal Kuzzle response from a 2-steps authentication process

Return Value #

Returns the Kuzzle SDK object to allow chaining.

Usage #

<?php
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
  */
  $kuzzle->setJwtToken($authenticationResponse);