Logs in the user identified by the userId parameter to Chatwee. Call this method whenever user logs into your service.
<?php
require_once(dirname( __FILE__ ) . "/ChatweeV2_SDK/Chatwee.php");
ChatweeV2_Configuration::setApiUrl(YOUR_API_URL);
ChatweeV2_Configuration::setChatId(YOUR_PERSONAL_CHAT_ID);
ChatweeV2_Configuration::setClientKey(YOUR_PERSONAL_CLIENT_KEY);
try {
$sessionId = ChatweeV2_SsoManager::loginUser(Array(
"userId" => "507f191e810c19729de860ea",
"userIp" => "192.168.0.1"
));
echo "The user has been logged in with the following session ID: " . $sessionId;
} catch(Exception $exception) {
echo "An error occured: " . $exception->getMessage();
}
?>
Name | Description | Type | Mandatory | Remarks |
---|---|---|---|---|
userId | ID of the user | string | yes | the value obtained from the ChatweeV2_SsoManager::registerUser method |
userIp | IP address of the user | string | no | - |