# Class: session

## LuCI. session

The `session` class provides various session related functionality.

#### new LuCI.session()

luci.js, line 1828

### Methods

#### getID(){string}

luci.js, line 1845

  Retrieve the current session ID.

  ##### Returns:

  Type | Description
  --- | ---
  string | Returns the current session ID.

#### getLocalData(key){*}

luci.js, line 1870

  Retrieve data from the local session storage.

  Name | Type | Description
  --- | --- | ---
  `key` | string | optional The key to retrieve from the session data store. If omitted, all session data will be returned.

  ##### Returns:

  Type | Description
  --- | ---
  * | Returns the stored session data or `null` if the given key wasn't found.

#### getToken(){string|null}

luci.js, line 1855

  Retrieve the current session token.

  ##### Returns:

  Type | Description
  --- | ---
  string | null | Returns the current session token or `null` if not logged in.

#### setLocalData(key, value){boolean}

luci.js, line 1904

  Set data in the local session storage.

  Name | Type | Description
  --- | --- | ---
  `key` | string | The key to set in the session data store.
  `value` | * | The value to store. It will be internally converted to JSON before being put in the session store.

  ##### Returns:

  Type | Description
  --- | ---
  boolean | Returns `true` if the data could be stored or `false` on error.