Authentication - senseobservationsystems/commonsense-imp GitHub Wiki

Home > Function Documentation > Authentication

Authentication using the CommonSense API can be done in multiple ways. In the library we provide a function for getting a session id from the API.

####GetSessionId (p_credentials)

Logs onto CommonSense to receive a session id.

Parameter Description
p_credentials a table containing "username" and "password" key/value pairs

Returns
The session id or the response status code in case of failure.

Example

local credentials = {};
credentials.username <- "user";
credentials.password <- "5f4dcc3b5aa765d61d8327deb882cf99";

local session_id = GetSessionId(credentials);

server.log("got session id " + session_id);
⚠️ **GitHub.com Fallback** ⚠️