Chatwee

ChatweeV2_SsoUser::login

Calls the /sso-user/login Chatwee API method. It returns the ID of a newly created session.


<?php

  require_once(dirname( __FILE__ ) . "/ChatweeV2_SDK/Chatwee.php");

  ChatweeV2_Configuration::setChatId(YOUR_PERSONAL_CHAT_ID);
  ChatweeV2_Configuration::setClientKey(YOUR_PERSONAL_CLIENT_KEY);

  try {
    $sessionId = ChatweeV2_SsoUser::login(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_SsoUser::register method
userIp user IP address string no is necessary if ban feature needs to be used against SSO users