A Client object is the representation of a client and it handles cookies. Cookies are stored in the client browser. Cookies may contain user preferences and we can use them to detect recurrent user activity.
By default, the cookie service is enabled in JBStrap, with cookies having 30 minutes of timeout interval. Within 30 minutes a user may freely close the current page and open it elsewhere, without having to log in.
When dealing with user cookies, the following two parameters are very important to keep in mind:
- USER_COOKIE_TIMEOUT : the timeout interval of a user cookie,
- USE_USER_COOKIE : sets whether the entire cookie service is active.
Also note that the parameter value must be an integer that specifies the duration in minutes. Modify cookie expiration interval to 1 month:
Disable user cookies:
Additionally, you can create your own cookies through the client object. These cookies can have any content, and they can be read or deleted. The duration of the custom cookies must be specified in seconds. Creating a cookie in the client:
Querying the cookie value:
Deleting a cookie from the client: