getUserToken

Learn how to get the visitor's user token.

This method provides the user token of the current session.

The token is anonymous unless the visitor has been identified.

Signature

This method has the following signature:

public function getUserToken(): Token

This method returns a Token that represents the visitor’s session as a JSON Web Token (JWT).

Example

Here is a basic example of how to use this method:

<?phpuse Croct\Plug\Croct;
$croct = Croct::fromDotenv();$token = $croct->getUserToken();